ó
    Ô›‘h?Õ  ã                   óÊ   • S SK Jr  S SKrS SKrS SKJrJrJrJrJ	r	J
r
  SSKJr  SSKJrJr  SSKJrJr  \R&                  S    S:H  r\" S	5      rS
rSr/ SQrSr " S S\5      rg)é    )Úunicode_literalsN)ÚAnyÚIterableÚOptionalÚTextÚTupleÚcasté   )ÚHyperlinkTestCaseé   )ÚURLÚURLParseError)Ú	inet_ptonÚSCHEME_PORT_MAPÚ ú*http://www.foo.com/a/nice/path/?zot=23&zutúhttp://a/b/c/d;p?q)()Úgúhttp://a/b/c/g)z./gr   )zg/úhttp://a/b/c/g/)z/gú
http://a/g)z//gzhttp://g)z?yzhttp://a/b/c/d;p?y)zg?yzhttp://a/b/c/g?y)z#szhttp://a/b/c/d;p?q#s)zg#szhttp://a/b/c/g#s)zg?y#szhttp://a/b/c/g?y#s)z;xzhttp://a/b/c/;x)zg;xzhttp://a/b/c/g;x)zg;x?y#szhttp://a/b/c/g;x?y#s)r   r   )Ú.úhttp://a/b/c/)z./r   )ú..úhttp://a/b/)z../r   )z../gúhttp://a/b/g)z../..ú	http://a/)z../../r   )z../../gr   )z
../../../gr   )z../../../../gr   )z/./gr   )z/../gr   )zg.zhttp://a/b/c/g.)z.gzhttp://a/b/c/.g)zg..zhttp://a/b/c/g..)z..gzhttp://a/b/c/..g)z./../gr   )z./g/.r   )zg/./hzhttp://a/b/c/g/h)zg/../hzhttp://a/b/c/h)z	g;x=1/./yzhttp://a/b/c/g;x=1/y)z
g;x=1/../yzhttp://a/b/c/y)zg?y/./xzhttp://a/b/c/g?y/./x)zg?y/../xzhttp://a/b/c/g?y/../x)zg#s/./xzhttp://a/b/c/g#s/./x)zg#s/../xzhttp://a/b/c/g#s/../x)6zhttp://localhostúhttp://localhost/zhttp://127.0.0.1/zhttp://[::127.0.0.1]/zhttp://[::1]/zhttp://localhost/foozhttp://localhost/foo/zhttp://localhost/foo!!bar/zhttp://localhost/foo%20bar/zhttp://localhost/foo%2Fbar/zhttp://localhost/foo?nzhttp://localhost/foo?n=vzhttp://localhost/foo?n=/a/bz%http://example.com/foo!@$bar?b!@z=123z$http://localhost/asd?a=asd%20sdf/345z6http://(%2525)/(%2525)?(%2525)&(%2525)=(%2525)#(%2525)z<http://(%C3%A9)/(%C3%A9)?(%C3%A9)&(%C3%A9)=(%C3%A9)#(%C3%A9)zG?sslrootcert=/Users/glyph/Downloads/rds-ca-2015-root.pem&sslmode=verifyz%http://googlewebsite.com/e-shops.aspxz?http://example.com:8080/search?q=123&business=Nothing%20Specialz*http://hatnote.com:9000/?arg=1&arg=2&arg=3úhttps://xn--bcher-kva.chz"http://xn--ggbla1c4e.xn--ngbc5azd/z.http://tools.ietf.org/html/rfc3986#section-3.4z:ftp://ftp.rfc-editor.org/in-notes/tar/RFCs0001-0500.tar.gzz.http://[1080:0:0:0:8:800:200C:417A]/index.htmlzssh://192.0.2.16:2222/z$https://[::101.45.75.219]:80/?hi=byez7ldap://[::192.9.5.5]/dc=example,dc=com??sub?(sn=Jensen)zFmailto:me@example.com?to=me@example.com&body=hi%20http://wikipedia.orgznews:alt.rec.motorcycleztel:+1-800-867-5309zurn:oasis:member:A00024:xa  magnet:?xt=urn:btih:1a42b9e04e122b97a5254e3df77ab3c4b7da725f&dn=Puppy%20Linux%20precise-5.7.1.iso&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.istole.it:6969&tr=udp://tracker.ccc.de:80&tr=udp://open.demonii.com:1337zhttps://%3A@example.com/zhttps://%40@example.com/zhttps://%2f@example.com/zhttps://a:%3a@example.com/zhttps://a:%40@example.com/zhttps://a:%2f@example.com/zhttps://a:%3f@example.com/zhttps://example.com/%2F/zhttps://example.com/%3F/zhttps://example.com/%23/zhttps://example.com/?%23=bzhttps://example.com/?%3D=bzhttps://example.com/?%26=bzhttps://example.com/?a=%23zhttps://example.com/?a=%26zhttps://example.com/?a=%3Dz https://example.com/?foo+bar=bazz https://example.com/?foo=bar+bazzChttp://(%2525):(%2525)@example.com/(%2525)/?(%2525)=(%2525)#(%2525)z8first_seg_rel_path__colon%3Anotok/second_seg__colon%3Aokc                   óà  • \ rS rSrSrS r SPS jrS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+S* r,S+ r-S, r.S- r/S. r0S/ r1S0 r2S1 r3S2 r4S3 r5S4 r6S5 r7S6 r8S7 r9S8 r:S9 r;S: r<S; r=S< r>S= r?S> r@S? rAS@ rBSA rCSB rDSC rESD rFSE rGSF rHSG rISH rJSI rKSJ rLSK rMSL rNSM rOSNrPgO)QÚTestURLé‘   z
Tests for L{URL}.
c                 óæ  • U R                  [        UR                  [        5      =(       d    UR                  SL [	        U5      5        U R                  [        UR
                  [        5      =(       d    UR
                  SL [	        U5      5        UR                   H,  nU R                  [        U5      [        [	        U5      5        M.     UR                   Hb  u  p4U R                  [        W5      [        [	        U5      5        U R                  USL =(       d    [        U[        5      [	        U5      5        Md     U R                  [        UR                  5      [        [	        U5      5        g)zT
The given L{URL}'s components should be L{unicode}.

@param u: The L{URL} to test.
N)Ú
assertTrueÚ
isinstanceÚschemeÚunicodeÚreprÚhostÚpathÚassertEqualÚtypeÚqueryÚfragment)ÚselfÚuÚsegÚ_kÚvs        Ú[C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\hyperlink/test/test_url.pyÚassertUnicodedÚTestURL.assertUnicoded–   só   € ð 	�‰Ü�q—x‘x¤Ó)×=¨Q¯X©X¸Ð-=¼tÀA»wô	
ð 	�‰œ
 1§6¡6¬7Ó3×E°q·v±vÀ°~ÄtÈAÃwÔOØ—6”6ˆCØ×ÑœT #›Y¬´°a³Ö9ñ à—w”w‰GˆRØ×ÑœT #›Y¬´°a³Ô9Ø�O‰O˜A ˜I×?¬°A´wÓ)?ÄÀaÃÖIñ ð 	×Ñœ˜aŸj™jÓ)¬7´D¸³GÕ<ó    c	                 ó  • UR                   UR                  UR                  UR                  UR                  UR
                  UR                  4n	UU[        U5      [        U5      UUUR                  4n
U R                  Xš5        g)aZ  
The given L{URL} should have the given components.

@param u: The actual L{URL} to examine.

@param scheme: The expected scheme.

@param host: The expected host.

@param path: The expected path.

@param query: The expected query.

@param fragment: The expected fragment.

@param port: The expected port.

@param userinfo: The expected userinfo.
N)	r&   r)   r*   r-   r.   ÚportÚuserinfoÚtupler+   )r/   r0   r&   r)   r*   r-   r.   r9   r:   ÚactualÚexpecteds              r4   Ú	assertURLÚTestURL.assertURL¨   sw   € ð@ �H‰HØ�F‰FØ�F‰FØ�G‰GØ�J‰JØ�F‰FØ�J‰Jð
ˆð ØÜ�$‹KÜ�%‹LØØØ�J‰Jð
ˆð 	×Ñ˜Õ*r7   c           	      óˆ   ^ • U 4S jnU" [        SS5      5        U" [        SS/ / 5      5        U" [        SS/ / S5      5        g)z0
L{URL} should have appropriate default values.
c           
      óX   >• TR                  U 5        TR                  U SS/ / SSS5        g )NÚhttpr   éP   )r5   r>   )r0   r/   s    €r4   ÚcheckÚ(TestURL.test_initDefaults.<locals>.checká   s+   ø€ à×Ñ Ô"Ø�N‰N˜1˜f b¨"¨b°"°b¸"Õ=r7   rB   r   N)r   )r/   rD   s   ` r4   Útest_initDefaultsÚTestURL.test_initDefaultsÛ   s@   ø€ õ	>ñ
 	Œc�&˜"‹oÔÙŒc�&˜"˜b "Ó%Ô&ÙŒc�&˜"˜b " bÓ)Õ*r7   c           	      óÎ   • [        SSS/SS/S5      nU R                  U5        U R                  USSS/SS/SS5        U R                  [        SS	S
/S/S5      SS	S
/S/SS5        g)z-
L{URL} should accept L{unicode} parameters.
ÚsÚhÚp©Úkr3   )rM   NÚfNrB   ô   Ã ô   Ã©)u   Î»u   Ï€u   âŠ¥rC   ©r   r5   r>   ©r/   r0   s     r4   Ú	test_initÚTestURL.test_initê   sƒ   € ô
 ��S˜3˜% *¨kÐ!:¸CÓ@ˆØ×Ñ˜AÔØ�‰�q˜#˜s S E¨J¸Ð+DÀcÈ4ÔPà�‰Ü�˜  Ð+?Ð*@À(ÓKØØØˆHØ!Ð"ØØõ	
r7   c           	      ó~   • [        SSS/SS/S5      nU R                  U5        U R                  USSS/SS/SS5        g)z>
L{URL} should accept (and not interpret) percent characters.
rI   z%68z%70)ú%6Bz%76)rV   Nz%66NrQ   rR   s     r4   Útest_initPercentÚTestURL.test_initPercentý   sM   € ô
 ��U˜U˜G n°mÐ%DÀeÓLˆØ×Ñ˜AÔØ�‰Øˆs�E˜E˜7 ^°]Ð$CÀUÈDõ	
r7   c                 ór   • U R                  [        [        SSS/SS/SS95      S[        S	5      < S
35        g)zš
L{URL.__repr__} will display the canonical form of the URL, wrapped in
a L{URL.from_text} invocation, so that it is C{eval}-able but still
easy to read.
rB   ÚfooÚbar)ÚbazNrL   Úfrob©r&   r)   r*   r-   r.   zURL.from_text(zhttp://foo/bar?baz&k=v#frobÚ)N)r+   r(   r   ©r/   s    r4   Ú	test_reprÚTestURL.test_repr  sF   € ð 	×ÑÜÜØ!ØØ˜Ø(¨*Ð5Ø#ñôô $(Ð(EÖ#FÐHõ	
r7   c                 ó€   • [         R                  " [        5      nU R                  [        UR	                  5       5        g)zK
Round-tripping L{URL.from_text} with C{str} results in an equivalent
URL.
N)r   Ú	from_textÚ	BASIC_URLr+   Úto_text©r/   Úurlpaths     r4   Útest_from_textÚTestURL.test_from_text  s)   € ô —-’-¤	Ó*ˆØ×Ñœ G§O¡OÓ$5Õ6r7   c                 ó†   • [          H7  n[        R                  " U5      R                  SS9nU R	                  X5        M9     g)z0
L{URL.to_text} should invert L{URL.from_text}.
T©Úwith_passwordN)ÚROUNDTRIP_TESTSr   rd   rf   r+   )r/   ÚtestÚresults      r4   Útest_roundtripÚTestURL.test_roundtrip%  s8   € ÷
 $ˆDÜ—]’] 4Ó(×0Ñ0¸tÐ0ÐDˆFØ×Ñ˜TÖ*ò $r7   c                 óâ   • [          He  n[        R                  " U5      nUR                  5       nUR                  5       nX4:X  d   eUR	                  SS9nUR	                  SS9nXV:X  a  Me   e   g )NTrl   )rn   r   rd   Úto_irirf   )r/   ro   ÚurlÚiriÚ
double_iriÚiri_textÚdouble_iri_texts          r4   Útest_roundtrip_double_iriÚ!TestURL.test_roundtrip_double_iri.  sp   € ç#ˆDÜ—-’- Ó%ˆCØ—*‘*“,ˆCØŸ™›ˆJØÓ$Ð$Ð$à—{‘{°�{Ð6ˆHØ(×0Ñ0¸tÐ0ÐDˆOØÕ.Ð.Ð.ñ $ð 	r7   c                 óØ   • [         R                  " [        5      nU R                  U[         R                  " [        5      5        U R	                  U[         R                  " S5      5        g)z—
Two URLs decoded using L{URL.from_text} will be equal (C{==}) if they
decoded same URL string, and unequal (C{!=}) if they decoded different
strings.
z:ftp://www.anotherinvaliddomain.com/foo/bar/baz/?zot=21&zutN)r   rd   re   r+   ÚassertNotEqualrg   s     r4   Útest_equalityÚTestURL.test_equality;  sK   € ô —-’-¤	Ó*ˆØ×Ñ˜¤#§-¢-´	Ó":Ô;Ø×ÑØÜ�MŠMØOóõ	
r7   c                 óº   • U R                  [        SS9[        5       5        U R                  [        R                  " S5      [        R                  " S5      5        g)zt
An URL created with the empty string for a fragment compares equal
to an URL created with an unspecified fragment.
r   )r.   zhttp://localhost/#r   N)r+   r   rd   r`   s    r4   Útest_fragmentEqualityÚTestURL.test_fragmentEqualityK  sC   € ð 	×Ñœ bÑ)¬3«5Ô1Ø×ÑÜ�MŠMÐ.Ó/Ü�MŠMÐ-Ó.õ	
r7   c                 ó°  • [         R                  " [        5      nU R                  SUR	                  S5      R                  5       5        U R                  SUR	                  S5      R                  5       5        U R                  SUR	                  S5      R                  5       5        U R                  SUR	                  S5      R                  5       5        g	)
zU
L{URL.child} appends a new path segment, but does not affect the query
or fragment.
z.http://www.foo.com/a/nice/path/gong?zot=23&zutÚgongz1http://www.foo.com/a/nice/path/gong%2F?zot=23&zutzgong/z7http://www.foo.com/a/nice/path/gong%2Fdouble?zot=23&zutzgong/doublez:http://www.foo.com/a/nice/path/gong%2Fdouble%2F?zot=23&zutzgong/double/N)r   rd   re   r+   Úchildrf   rg   s     r4   Ú
test_childÚTestURL.test_childW  s°   € ô —-’-¤	Ó*ˆØ×ÑØ<Ø�M‰M˜&Ó!×)Ñ)Ó+ô	
ð 	×ÑØ?Ø�M‰M˜'Ó"×*Ñ*Ó,ô	
ð 	×ÑØEØ�M‰M˜-Ó(×0Ñ0Ó2ô	
ð 	×ÑØHØ�M‰M˜.Ó)×1Ñ1Ó3õ	
r7   c                 ó’   • [         R                  " S5      nU R                  UR                  SSS5      R	                  5       S5        g)zO
L{URL.child} receives multiple segments as C{*args} and appends each in
turn.
zhttp://example.com/a/bÚcÚdÚezhttp://example.com/a/b/c/d/eN)r   rd   r+   r…   rf   ©r/   ru   s     r4   Útest_multiChildÚTestURL.test_multiChildo  s=   € ô �mŠmÐ4Ó5ˆØ×ÑØ�I‰I�c˜3 Ó$×,Ñ,Ó.Ð0Nõ	
r7   c                 óª   • [        SS9R                  S5      nU R                  UR                  5        U R	                  SUR                  5       5        g)zW
L{URL.child} of a L{URL} without a path produces a L{URL} with a single
path segment.
úwww.foo.com©r)   r‰   zhttp://www.foo.com/cN)r   r…   r$   Úrootedr+   rf   )r/   ÚchildURLs     r4   Útest_childInitRootÚTestURL.test_childInitRootz  sC   € ô ˜MÑ*×0Ñ0°Ó5ˆØ�‰˜Ÿ™Ô(Ø×ÑÐ/°×1AÑ1AÓ1CÕDr7   c                 óV   • [        SS9nU R                  UR                  5       U5        g)zD
L{URL.child} without any new segments returns the original L{URL}.
r�   r‘   N)r   r+   r…   rŒ   s     r4   Útest_emptyChildÚTestURL.test_emptyChild„  s$   € ô
 �}Ñ%ˆØ×Ñ˜Ÿ™› cÕ*r7   c                 ó$  • [         R                  " [        5      nU R                  SUR	                  S5      R                  5       5        Sn[         R                  " U5      nU R                  SUR	                  S5      R                  5       5        g)zg
L{URL.sibling} of a L{URL} replaces the last path segment, but does not
affect the query or fragment.
z0http://www.foo.com/a/nice/path/sister?zot=23&zutÚsisterz)http://www.foo.com/a/nice/path?zot=23&zutz+http://www.foo.com/a/nice/sister?zot=23&zutN)r   rd   re   r+   Úsiblingrf   )r/   rh   Úurl_texts      r4   Útest_siblingÚTestURL.test_siblingŒ  ss   € ô —-’-¤	Ó*ˆØ×ÑØ>Ø�O‰O˜HÓ%×-Ñ-Ó/ô	
ð
 ?ˆÜ—-’- Ó)ˆØ×ÑØ9Ø�O‰O˜HÓ%×-Ñ-Ó/õ	
r7   c                 óÊ  • [         R                  " [        5      nU R                  SUR	                  S5      R                  5       5        U R                  SUR	                  S5      R                  5       5        U R                  SUR	                  S5      R                  5       5        U R                  SUR	                  S5      R                  5       5        U R                  S	UR	                  S
5      R                  5       ;  5        [         R                  " S5      nU R                  SUR	                  S5      R                  5       5        [         R                  " S5      nU R                  UR	                  S5      R                  5       S5        [         R                  " S5      nSnU R                  UR	                  S5      R                  5       U5        U R                  UR	                  5       R                  5       U5        [         R                  " S5      n[         R                  " S5      nUR	                  U5      nU R                  UR                  5       S5        g)zŽ
L{URL.click} interprets the given string as a relative URI-reference
and returns a new L{URL} interpreting C{self} as the base absolute URI.
r   r   z$http://www.foo.com/a/nice/path/clickÚclickzhttp://www.foo.com/clickz/clickz$http://www.foo.com/a/nice/path/?burpz?burpz//foobarzhttp://www.foo.com/foobarzhttp://www.foo.com/me/noqueryz!http://www.foo.com/me/17?spam=158z/me/17?spam=158zhttp://localhost/foo?abc=defzhttp://www.python.orgz$http://hatnote.com/a/b/../c/./d/e/..zhttp://hatnote.com/a/c/d/zhttp://localhost/foo/?abc=defr[   zhttp://localhost/foo/barN)r   rd   re   r+   r    rf   r$   ÚfromText)r/   rh   r0   ÚresÚu2Úu3s         r4   Ú
test_clickÚTestURL.test_clickŸ  sç  € ô —-’-¤	Ó*ˆà×ÑØ8Ø�M‰M˜"Ó×%Ñ%Ó'ô	
ð
 	×ÑØ2Ø�M‰M˜'Ó"×*Ñ*Ó,ô	
ð
 	×ÑØ&¨¯©°hÓ(?×(GÑ(GÓ(Iô	
ð 	×ÑØ2Ø�M‰M˜'Ó"×*Ñ*Ó,ô	
ð 	�‰ØØ—=‘=Ð!<Ó=×EÑEÓGñHô	
ô �MŠMÐ9Ó:ˆØ×ÑØ/Ø�G‰GÐ%Ó&×.Ñ.Ó0ô	
ô �MŠMÐ8Ó9ˆØ×ÑØ�G‰GÐ+Ó,×4Ñ4Ó6Ð8Oô	
ô
 �MŠMÐ@ÓAˆØ)ˆØ×Ñ˜Ÿ™ ›×,Ñ,Ó.°Ô4ð 	×Ñ˜Ÿ™›×*Ñ*Ó,¨cÔ2ô �LŠLÐ8Ó9ˆÜ�]Š]˜5Ó!ˆØ�W‰W�R‹[ˆØ×Ñ˜Ÿ™›Ð'AÕBr7   c                 ó´   • [         R                  " [        5      n[         H4  u  p#U R	                  UR                  U5      R                  5       U5        M6     g)zA
L{URL.click} should correctly resolve the examples in RFC 3986.
N)r   rd   ÚrelativeLinkBaseForRFC3986ÚrelativeLinkTestsForRFC3986r+   r    rf   )r/   ÚbaseÚrefr=   s       r4   Útest_clickRFC3986ÚTestURL.test_clickRFC3986Ý  s@   € ô
 �}Š}Ô7Ó8ˆß:‰OˆSØ×Ñ˜TŸZ™Z¨›_×4Ñ4Ó6¸ÖAò  ;r7   c                 ó¼   • [         R                  " [        5      nU R                  [        UR
                  S5        U R                  [        UR
                  S5        g)z=
L{URL.click} should not accept schemes with relative paths.
zg:hzhttp:hN)r   rd   r¨   ÚassertRaisesÚNotImplementedErrorr    )r/   rª   s     r4   Útest_clickSchemeRelPathÚTestURL.test_clickSchemeRelPathæ  sA   € ô
 �}Š}Ô7Ó8ˆØ×ÑÔ-¨t¯z©z¸5ÔAØ×ÑÔ-¨t¯z©z¸8ÕDr7   c           
      ó4  • [         R                  " S5      nU R                  UR                  UR                  UR
                  UR                  UR                  UR                  UR                  5      U5        U R                  UR                  5       U5        g)zN
Verify that L{URL.replace} doesn't change any of the arguments it
is passed.
zhttps://x:1/y?z=1#AN)
r   rd   r+   Úreplacer&   r)   r*   r-   r.   r9   rg   s     r4   Útest_cloneUnchangedÚTestURL.test_cloneUnchangedï  sw   € ô —-’-Ð 5Ó6ˆØ×ÑØ�O‰OØ—‘Ø—‘Ø—‘Ø—‘Ø× Ñ Ø—‘óð ô
	
ð 	×Ñ˜Ÿ™Ó*¨GÕ4r7   c                 ó,  • / SQ/ SQ/ SQ/ SQ/ SQ/ SQ/ SQ/ SQ/ S	Q/ S
Q/ SQ/ SQ/ SQ/nU He  u  p#n[         R                  " U5      R                  U5      R                  5       nU R	                  UUSR                  U[        U5      UUS95        Mg     g)zL
L{URL.click} collapses C{.} and C{..} according to RFC 3986 section
5.2.4.
)r   r   r   )r   r   r   )úhttp://localhost/a/b/cr   zhttp://localhost/a/b/)r¸   r   zhttp://localhost/a/)r¸   z./d/ezhttp://localhost/a/b/d/e)r¸   ú../d/eúhttp://localhost/a/d/e)r¸   z/./d/eúhttp://localhost/d/e)r¸   z/../d/er»   )zhttp://localhost/a/b/c/z
../../d/e/zhttp://localhost/a/d/e/)zhttp://localhost/a/./cr¹   r»   )zhttp://localhost/a/./c/r¹   rº   )zhttp://localhost/a/b/c/dz./e/../f/../gzhttp://localhost/a/b/c/g)r¸   zd//ezhttp://localhost/a/b/d//ez1{start}.click({click}) => {actual} not {expected})Ústartr    r<   r=   N)r   rd   r    rf   r+   Úformatr(   )r/   Útestsr¼   r    r=   r<   s         r4   Útest_clickCollapseÚTestURL.test_clickCollapse  s§   € ò <Ú<ÚDÚCÚKÚJÚHÚIòò
 IÚKòò
 Lð+
ˆó. ',Ñ"ˆE˜(Ü—]’] 5Ó)×/Ñ/°Ó6×>Ñ>Ó@ˆFØ×ÑØØØC×JÑJØÜ˜u›+Ø!Ø%ð	 Kð ö	ò ',r7   c                 óh  • U R                  S[        R                  " S5      R                  SS5      R	                  5       5        U R                  S[        SS9R                  SS5      R	                  5       5        [        R                  " [
        5      nU R                  SUR                  S	5      R	                  5       5        U R                  S
UR                  S	S5      R	                  5       5        U R                  SUR                  S	S5      R                  S5      R	                  5       5        U R                  SUR                  S5      R                  S	S5      R	                  5       5        U R                  SUR                  S	S5      R                  SS5      R	                  5       5        g)z#
L{URL.add} adds query parameters.
z'http://www.foo.com/a/nice/path/?foo=barzhttp://www.foo.com/a/nice/path/rZ   r[   zhttp://www.foo.com/?foo=barr�   r‘   z/http://www.foo.com/a/nice/path/?zot=23&zut&burpÚburpz3http://www.foo.com/a/nice/path/?zot=23&zut&burp=xxxÚxxxz8http://www.foo.com/a/nice/path/?zot=23&zut&burp=xxx&zingÚzingz8http://www.foo.com/a/nice/path/?zot=23&zut&zing&burp=xxxz:http://www.foo.com/a/nice/path/?zot=23&zut&burp=xxx&zot=32ÚzotÚ32N)r+   r   rd   Úaddrf   re   rg   s     r4   Útest_queryAddÚTestURL.test_queryAdd-  sg  € ð
 	×ÑØ5Ü�MŠMÐ;Ó<ß‰S�˜Óß‰W‹Yô		
ð 	×ÑØ)Ü�]Ñ#×'Ñ'¨¨uÓ5×=Ñ=Ó?ô	
ô —-’-¤	Ó*ˆØ×ÑØ=Ø�K‰K˜Ó×'Ñ'Ó)ô	
ð 	×ÑØAØ�K‰K˜ Ó&×.Ñ.Ó0ô	
ð 	×ÑØFØ�K‰K˜ Ó&×*Ñ*¨6Ó2×:Ñ:Ó<ô	
ð
 	×ÑØFØ�K‰K˜Ó×#Ñ# F¨EÓ2×:Ñ:Ó<ô	
ð
 	×ÑØHØ�K‰K˜ Ó&×*Ñ*¨5°$Ó7×?Ñ?ÓAõ	
r7   c                 ó–  • [         R                  " [        5      nU R                  SUR	                  SS5      R                  5       5        U R                  SUR	                  S5      R	                  SS5      R                  5       5        U R                  SUR                  SS5      R	                  SS5      R                  5       5        g)	z/
L{URL.set} replaces query parameters by name.
z*http://www.foo.com/a/nice/path/?zot=32&zutrÅ   rÆ   z0http://www.foo.com/a/nice/path/?zot&zut=itworkedÚzutÚitworkedrÃ   N)r   rd   re   r+   Úsetrf   rÇ   rg   s     r4   Útest_querySetÚTestURL.test_querySetT  s¦   € ô
 —-’-¤	Ó*ˆØ×ÑØ8Ø�K‰K˜˜tÓ$×,Ñ,Ó.ô	
ð
 	×ÑØ>Ø�K‰K˜Ó×"Ñ" 5¨*Ó5×=Ñ=Ó?ô	
ð 	×ÑØ8Ø�K‰K˜˜uÓ%×)Ñ)¨%°Ó6×>Ñ>Ó@õ	
r7   c                 óÔ  • [         R                  " S5      nU R                  UR                  S5      [         R                  " S5      5        U R                  UR                  SSS9[         R                  " S5      5        U R                  UR                  SSS9[         R                  " S5      5        U R                  UR                  SSS	S
9[         R                  " S5      5        g)z7
L{URL.remove} removes instances of a query parameter.
z*https://example.com/a/b/?foo=1&bar=2&foo=3rZ   zhttps://example.com/a/b/?bar=2Ú1)ÚnameÚvaluez$https://example.com/a/b/?bar=2&foo=3r
   )rÒ   Úlimitr   )rÒ   rÓ   rÔ   N)r   rd   r+   ÚremoverŒ   s     r4   Útest_queryRemoveÚTestURL.test_queryRemovej  sÂ   € ô
 �mŠmÐHÓIˆØ×ÑØ�J‰J�uÓœsŸ}š}Ð-MÓNô	
ð 	×ÑØ�J‰J˜E¨ˆJÐ-Ü�MŠMÐ@ÓAô	
ð
 	×ÑØ�J‰J˜E¨ˆJÐ+Ü�MŠMÐ@ÓAô	
ð
 	×ÑØ�J‰J˜E¨°AˆJÐ6Ü�MŠMÐFÓGõ	
r7   c                 óH  • [         R                  " S5      nU R                  UR                  S5      S/5        U R                  UR	                  5       S5        [         R                  " S5      nU R                  UR
                  S5        U R                  UR	                  5       S5        [         R                  " S5      nUR                  5       nU R                  UR                  S5      S/5        U R                  UR                  5       R                  S5      S/5        g	)
zh
Every C{=}-sign after the first in a query parameter is simply included
in the value of the parameter.
zhttp://localhost/?=x=x=xr   úx=x=xz!http://localhost/?foo=x=x=x&bar=y))rZ   rÙ   )r[   Úyz7https://example.com/?argument=3&argument=4&operator=%3DÚoperatorÚ=N)r   rd   r+   Úgetrf   r-   rt   Úto_uri)r/   r0   rv   s      r4   Útest_parseEqualSignInParamValueÚ'TestURL.test_parseEqualSignInParamValueƒ  sÛ   € ô �MŠMÐ4Ó5ˆØ×Ñ˜Ÿ™˜r› W IÔ.Ø×Ñ˜Ÿ™›Ð&@ÔAÜ�MŠMÐ=Ó>ˆØ×Ñ˜Ÿ™Ð"BÔCØ×Ñ˜Ÿ™›Ð&IÔJä�MŠMØEó
ˆð �h‰h‹jˆØ×Ñ˜Ÿ™ Ó,¨s¨eÔ4à×Ñ˜Ÿ™›×)Ñ)¨*Ó5¸°uÕ=r7   c                 óT   • U R                  [        5       R                  5       S5        g)z7
An empty L{URL} should serialize as the empty string.
r   N)r+   r   rf   r`   s    r4   Ú
test_emptyÚTestURL.test_empty˜  s   € ð
 	×Ñœ›Ÿ™›¨"Õ-r7   c                 óX   • [        S/S9nU R                  UR                  5       S5        g)z@
An L{URL} with query text should serialize as just query text.
©ÚhelloÚworld©r-   z?hello=worldN)r   r+   rf   rR   s     r4   Útest_justQueryTextÚTestURL.test_justQueryTextŸ  s(   € ô
 Ð)Ð*Ñ+ˆØ×Ñ˜Ÿ™› nÕ5r7   c                 óR   • [         R                  " S5      nU R                  X5        g)z"
L{URL} compares equal to itself.
r   N©r   rd   r+   rR   s     r4   Útest_identicalEqualÚTestURL.test_identicalEqual§  s!   € ô
 �MŠMÐ-Ó.ˆØ×Ñ˜Õr7   c                 ó~   • [         R                  " S5      n[         R                  " S5      nU R                  X5        g)z7
URLs with equivalent components should compare equal.
ú%http://u@localhost:8080/p/a/t/h?q=p#fNrì   ©r/   Úu1r£   s      r4   Útest_similarEqualÚTestURL.test_similarEqual¯  s0   € ô
 �]Š]ÐBÓCˆÜ�]Š]ÐBÓCˆØ×Ñ˜Õ r7   c                 ó´   • [         R                  " S5      n[         R                  " S5      nU R                  X:H  U< SU< 35        U R                  X5        g)zd
L{URL}s that refer to different resources are both unequal (C{!=}) and
also not equal (not C{==}).
úhttp://localhost/aúhttp://localhost/bú != N)r   rd   ÚassertFalser}   rñ   s      r4   Útest_differentNotEqualÚTestURL.test_differentNotEqual¸  sG   € ô �]Š]Ð/Ó0ˆÜ�]Š]Ð/Ó0ˆØ×Ñ˜™³²RÐ#8Ô9Ø×Ñ˜BÕ#r7   c                 óì   • [         R                  " S5      nU R                  US:H  S5        U R                  U[        5       :H  S5        U R	                  US5        U R	                  U[        5       5        g)z-
L{URL} is not equal (C{==}) to other types.
r   é*   zURL must not equal a number.zURL must not equal an object.N)r   rd   rù   Úobjectr}   rR   s     r4   Útest_otherTypesNotEqualÚTestURL.test_otherTypesNotEqualÃ  sa   € ô
 �MŠMÐ-Ó.ˆØ×Ñ˜˜b™Ð"@ÔAØ×Ñ˜œf›h™Ð(GÔHØ×Ñ˜A˜rÔ"Ø×Ñ˜Aœv›xÕ(r7   c                 ó^   • [         R                  " S5      nU R                  X:g  SU-  5        g)z:
Identical L{URL}s are not unequal (C{!=}) to each other.
rð   z%r == itselfN©r   rd   rù   rR   s     r4   Útest_identicalNotUnequalÚ TestURL.test_identicalNotUnequalÎ  s*   € ô
 �MŠMÐAÓBˆØ×Ñ˜™ °!Ñ!3Õ4r7   c                 ó’   • [         R                  " S5      n[         R                  " S5      nU R                  X:g  U< SU< 35        g)zE
Structurally similar L{URL}s are not unequal (C{!=}) to each other.
rð   ú == Nr  rñ   s      r4   Útest_similarNotUnequalÚTestURL.test_similarNotUnequalÖ  s9   € ô
 �]Š]ÐBÓCˆÜ�]Š]ÐBÓCˆØ×Ñ˜™³²RÐ#8Õ9r7   c                 ó’   • [         R                  " S5      n[         R                  " S5      nU R                  X:g  U< SU< 35        g)zC
Structurally different L{URL}s are unequal (C{!=}) to each other.
rö   r÷   r  N)r   rd   r$   rñ   s      r4   Útest_differentUnequalÚTestURL.test_differentUnequalß  s7   € ô
 �]Š]Ð/Ó0ˆÜ�]Š]Ð/Ó0ˆØ�‰˜™³²BÐ"7Õ8r7   c                 ó”   • [         R                  " S5      nU R                  US:g  S5        U R                  U[        5       :g  S5        g)z+
L{URL} is unequal (C{!=}) to other types.
r   rý   zURL must differ from a number.z"URL must be differ from an object.N)r   rd   r$   rþ   rR   s     r4   Útest_otherTypesUnequalÚTestURL.test_otherTypesUnequalè  s;   € ô
 �MŠMÐ-Ó.ˆØ�‰˜˜R™Ð!AÔBØ�‰˜œV›X™Ð'KÕLr7   c                 ó`  • Sn[         R                  " U5      nUR                  5       nU R                  UR                  S5        U R                  UR
                  S   S5        U R                  UR                  5       U5        SnUR                  5       nU R                  XTU< SU< 35        g)zs
L{URL.asURI} produces an URI which converts any URI unicode encoding
into pure US-ASCII and returns a new L{URL}.
õ   http://Ã©.com/eÌ�?aÌ�=iÌ�#uÌ�u   Ã©.comr   u   eÌ�ú.http://xn--9ca.com/%C3%A9?%C3%A1=%C3%AD#%C3%BArø   N)r   rd   ÚasURIr+   r)   r*   rf   )r/   Úunicodeyrv   ÚuriÚexpectedURIÚ	actualURIs         r4   Ú
test_asURIÚTestURL.test_asURIñ  s™   € ðBð 	ô �mŠm˜HÓ%ˆØ�i‰i‹kˆØ×Ñ˜Ÿ™Ð#LÔMØ×ÑØ�H‰H�Q‰KÐMô	
ð 	×Ñ˜Ÿ™›¨Ô1ØFˆØ—K‘K“Mˆ	Ø×ÑØ³)º[Ð$Iõ	
r7   c                 ó`  • Sn[         R                  " U5      nUR                  5       nU R                  UR                  S5        U R                  UR
                  S   S5        U R                  UR                  5       U5        SnUR                  5       nU R                  XTU< SU< 35        g)z„
L{URL.asIRI} decodes any percent-encoded text in the URI, making it
more suitable for reading by humans, and returns a new L{URL}.
r  zxn--9ca.comr   z%C3%A9u   http://Ã©.com/Ã©?Ã¡=Ã­#Ãºrø   N)r   rd   ÚasIRIr+   r)   r*   rf   )r/   Úasciiishr  rv   ÚexpectedIRIÚ	actualIRIs         r4   Ú
test_asIRIÚTestURL.test_asIRI  s”   € ð DˆÜ�mŠm˜HÓ%ˆØ�i‰i‹kˆØ×Ñ˜Ÿ™ =Ô1Ø×Ñ˜Ÿ™ !™ hÔ/Ø×Ñ˜Ÿ™›¨Ô1ð3ð 	ð —K‘K“Mˆ	Ø×ÑØ³)º[Ð$Iõ	
r7   c                 óª   • Sn[         R                  " U5      nUR                  5       nSnUR                  5       nU R	                  XTU< SU< 35        g)z„
Bad UTF-8 in a path segment, query parameter, or fragment results in
that portion of the URI remaining percent-encoded in the IRI.
z http://xn--9ca.com/%00%FF/%C3%A9u   http://Ã©.com/%00%FF/Ã©rø   N)r   rd   r  rf   r+   )r/   ÚurlWithBinaryr  rv   r  r  s         r4   Útest_badUTF8AsIRIÚTestURL.test_badUTF8AsIRI#  sQ   € ð ;ˆÜ�mŠm˜MÓ*ˆØ�i‰i‹kˆð2ð 	ð
 —K‘K“Mˆ	Ø×ÑØ³)º[Ð$Iõ	
r7   c                 ó”   • Sn[         R                  " U5      nUR                  5       nU R                  UR	                  5       U5        g)zD
A L{URL} composed of non-ASCII text will result in non-ASCII text.
r  N)r   rd   r  r+   rf   )r/   r  rv   ÚalsoIRIs       r4   Útest_alreadyIRIAsIRIÚTestURL.test_alreadyIRIAsIRI6  s?   € ðBð 	ô �mŠm˜HÓ%ˆØ—)‘)“+ˆØ×Ñ˜Ÿ™Ó*¨HÕ5r7   c                 ó’   • Sn[         R                  " U5      nUR                  5       R                  5       nU R	                  X15        g)z8
A L{URL} composed of encoded text will remain encoded.
r  N)r   rd   r  rf   r+   )r/   r  r  r  s       r4   Útest_alreadyURIAsURIÚTestURL.test_alreadyURIAsURIF  s:   € ð
 GˆÜ�mŠm˜KÓ(ˆØ—I‘I“K×'Ñ'Ó)ˆ	Ø×Ñ˜Õ0r7   c                 ó¾  • [         R                  " S5      nU R                  UR                  S5      S5        U R                  UR                  S5      S5        U R                  UR                  S5        U R                  UR
                  S5        U R                  UR                  5       S5        U R                  UR                  SS	9R                  5       S
5        g)zc
L{URL.from_text} will parse the C{userinfo} portion of the URI
separately from the host and port.
z<http://someuser:somepassword@example.com/some-segment@ignoreTz!someuser:somepassword@example.comFzsomeuser:@example.comzsomeuser:somepasswordÚsomeuserz0http://someuser:@example.com/some-segment@ignore©r:   z/http://someuser@example.com/some-segment@ignoreN)r   rd   r+   Ú	authorityr:   Úuserrf   r´   rŒ   s     r4   Útest_userinfoÚTestURL.test_userinfoP  s½   € ô �mŠmØJó
ˆð 	×ÑØ�M‰M˜$ÓÐ!Dô	
ð 	×Ñ˜Ÿ™ uÓ-Ð/FÔGØ×Ñ˜Ÿ™Ð'>Ô?Ø×Ñ˜Ÿ™ :Ô.Ø×ÑØ�K‰K‹MÐMô	
ð 	×ÑØ�K‰K ˆKÐ,×4Ñ4Ó6Ø=õ	
r7   c                 ó¨   • [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        g)z:
L{URL.from_text} parses custom port numbers as integers.
zhttp://www.example.com:8080/i�  N)r   rd   r+   r9   rf   )r/   ÚportURLs     r4   Útest_portTextÚTestURL.test_portTextg  s?   € ô
 —-’-Ð >Ó?ˆØ×Ñ˜Ÿ™ tÔ,Ø×Ñ˜Ÿ™Ó*Ð,JÕKr7   c                 ól   • U R                  [        R                  " S5      R                  5       S5        g)zë
Although L{URL} instances are mainly for dealing with HTTP, other
schemes (such as C{mailto:}) should work as well.  For example,
L{URL.from_text}/L{URL.to_text} round-trips cleanly for a C{mailto:}
URL representing an email address.
zmailto:user@example.comN)r+   r   rd   rf   r`   s    r4   Útest_mailtoÚTestURL.test_mailtop  s+   € ð 	×ÑÜ�MŠMÐ3Ó4×<Ñ<Ó>Ø%õ	
r7   c                 ó  • [         R                  " S5      nU R                  UR                  S5        U R                  UR                  S5        U R                  UR
                  S5        U R                  UR                  5       S5        g)zR
An HTTP URL without a hostname, but with a path, should also round-trip
cleanly.
zhttp:relative-pathr   )zrelative-pathFN)r   rd   r+   r)   r*   Úuses_netlocrf   )r/   Úwithout_hosts     r4   Útest_httpWithoutHostÚTestURL.test_httpWithoutHost}  sp   € ô —}’}Ð%9Ó:ˆØ×Ñ˜×*Ñ*¨BÔ/Ø×Ñ˜×*Ñ*Ð,>Ô?Ø×Ñ˜×1Ñ1°5Ô9Ø×Ñ˜×-Ñ-Ó/Ð1EÕFr7   c                 ó¢   • Sn[        S/S9nU R                  UR                  U5        [        SS0S9nU R                  UR                  U5        g)z”
When a L{URL} is created with a C{query} argument, the C{query}
argument is converted into an N-tuple of 2-tuples, sensibly
handling dictionaries.
)©ÚalphaÚbetar?  rè   r@  rA  N)r   r+   r-   )r/   r=   ru   s      r4   Útest_queryIterableÚTestURL.test_queryIterable‰  sN   € ð (ˆÜÐ*Ð+Ñ,ˆØ×Ñ˜Ÿ™ HÔ-Ü˜ &Ð)Ñ*ˆØ×Ñ˜Ÿ™ HÕ-r7   c                 óR   • [        SS/S9nU R                  UR                  S5        g)zZ
When a L{URL} is created with a C{path} argument, the C{path} is
converted into a tuple.
ræ   rç   ©r*   rå   N)r   r+   r*   rŒ   s     r4   Útest_pathIterableÚTestURL.test_pathIterable–  s(   € ô ˜ Ð)Ñ*ˆØ×Ñ˜Ÿ™Ð#5Õ6r7   c           	      óB  ^ ^^•  " S S[         5      m[        [        L a  SOSnU 4S jmU4UUU 4S jjnU" S5        U" S5        U" S	5        U" S
S5        U" S5        U" SS5        T R                  [        5       n[        [        [        T" 5       5      /S9  SSS5        T" WUS5        T R                  [        5       n[        S[        [        T" 5       5      4/S9  SSS5        T" X1S-   S5        T R                  [        5       n[        [        [        T" 5       5      S4/S9  SSS5        T" X1S5        T R                  [        5         [        [        [        [        [        4   T" 5       5      /S9  SSS5        T R                  [        5         [        [        [        [        [        4   S5      /S9  SSS5        T R                  [        5         [        [        [        [        [        4   S5      /S9  SSS5        [
        R                  " S5      nT R                  [        5       nUR                  [        [        T" 5       5      5        SSS5        T" X1S5        T R                  [        5       nUR                  [        [        T" 5       5      5        SSS5        T" X1S5        T R                  [        5       nUR                  [        [        T" 5       5      5        SSS5        T" X1S5        g! , (       d  f       GNn= f! , (       d  f       GN9= f! , (       d  f       GN= f! , (       d  f       GNÃ= f! , (       d  f       GN’= f! , (       d  f       GNa= f! , (       d  f       GN= f! , (       d  f       Ná= f! , (       d  f       N§= f)al  
Passing an argument of the wrong type to any of the constructor
arguments of L{URL} will raise a descriptive L{TypeError}.

L{URL} typechecks very aggressively to ensure that its constitutent
parts are all properly immutable and to prevent confusing errors when
bad data crops up in a method call long after the code that called the
constructor is off the stack.
c                   ó    • \ rS rSrS rS rSrg)Ú1TestURL.test_invalidArguments.<locals>.Unexpectedi«  c                 ó   • g)NÚwrong© r`   s    r4   Ú__str__Ú9TestURL.test_invalidArguments.<locals>.Unexpected.__str__¬  s   € àr7   c                 ó   • g)Nú<unexpected>rM  r`   s    r4   Ú__repr__Ú:TestURL.test_invalidArguments.<locals>.Unexpected.__repr__°  s   € à%r7   rM  N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rN  rR  Ú__static_attributes__rM  r7   r4   Ú
UnexpectedrJ  «  s   † òõ&r7   rY  r'   Ústrc                 óp   >• TR                  [        U R                  5      SR                  XS5      5        g )Nzexpected {0} for {1}, got {2}rQ  )r+   rZ  Ú	exceptionr½   )ÚraisedÚexpectationrÒ   r/   s      €r4   ÚassertRaisedÚ3TestURL.test_invalidArguments.<locals>.assertRaised¶  s2   ø€ à×ÑÜ�F×$Ñ$Ó%Ø/×6Ñ6Ø ~óõr7   c                 óš   >• TR                  [        5       n[        S0 U T" 5       0D6  S S S 5        T" WX5        g ! , (       d  f       N= f)NrM  )r¯   Ú	TypeErrorr   )Úparamr^  r]  rY  r_  r/   s      €€€r4   rD   Ú,TestURL.test_invalidArguments.<locals>.check¿  s?   ø€ à×"Ñ"¤9Ô-°ÜÑ,�u™j›lÐ+Ò,÷ .ñ ˜ Õ4÷ .Õ-ús	   —<¼
A
r&   r)   r.   r’   Úboolr:   r9   zint or NoneTyperE  Nzpath segmentrÒ   rè   z or NoneTypezquery parameter valuerÓ   zquery parameter name)rM   r3   Úvv)rM   zhttps://valid.example.com/zrelative URL)rþ   ÚbytesrZ  r¯   rb  r   r	   r   r   Ú
ValueErrorrd   r…   r›   r    )r/   ÚdefaultExpectationrD   r]  ru   rY  r_  s   `    @@r4   Útest_invalidArgumentsÚTestURL.test_invalidArgumentsŸ  s²  ú€ ô	&œô 	&ô +0´3ª,™Y¸EÐõ	ð &8÷ 	5ñ 	5ñ 	ˆhŒÙˆfŒÙˆjÔÙˆh˜ÔÙˆjÔÙˆfÐ'Ô(à×ÑœyÔ)¨VÜ”dœ4¡£Ó.Ð/Ò0÷ *ñ 	�VÐ/°Ô@à×ÑœyÔ)¨VÜ˜¤¤T©:«<Ó 8Ð9Ð:Ò;÷ *ñ 	Ø¨Ñ7Ð9Pô	
ð ×ÑœyÔ)¨VÜœœT¡:£<Ó0°'Ð:Ð;Ò<÷ *ñ 	�VÐ1GÔHð ×ÑœyÕ)Ü”tœE¤$¬ *Ñ-©z«|Ó<Ð=Ò>÷ *ð ×ÑœzÕ*Ü”tœE¤$¬ *Ñ-Ð/?Ó@ÐAÒB÷ +ð ×ÑœzÕ*Ü”tœE¤$¬ *Ñ-¨vÓ6Ð7Ò8÷ +ô �mŠmÐ8Ó9ˆØ×ÑœyÔ)¨VØ�I‰I”dœ4¡£Ó.Ô/÷ *á�V°Ô@Ø×ÑœyÔ)¨VØ�K‰KœœT¡:£<Ó0Ô1÷ *á�V°Ô@Ø×ÑœyÔ)¨VØ�I‰I”dœ4¡£Ó.Ô/÷ *á�V°Õ@÷K *Ö)ú÷
 *Ö)ú÷ *Ö)ú÷ *Ö)ú÷ +Ö*ú÷ +Ö*ú÷ *Ö)ú÷ *Õ)ú÷ *Õ)úsl   Á<LÃ LÄ
 L%Å+L7Æ&M	Ç&MÈ4%M-É?%M?Ë
%NÌ
LÌ
L"Ì%
L4Ì7
MÍ	
MÍ
M*Í-
M<Í?
NÎ
Nc                 óî   • U R                  [        5       n[        SS9  SSS5        U R                  [	        WR
                  5      SR                  [        S5      5      5        g! , (       d  f       NL= f)z˜
Technically, L{str} (or L{unicode}, as appropriate) is iterable, but
C{URL(path="foo")} resulting in C{URL.from_text("f/o/o")} is never what
you want.
rZ   rE  Nz,expected iterable of text for path, not: {0})r¯   rb  r   r+   rZ  r\  r½   r(   )r/   r]  s     r4   Ú!test_technicallyTextIsIterableButÚ)TestURL.test_technicallyTextIsIterableButô  sW   € ð ×ÑœyÔ)¨VÜ�UŠO÷ *à×ÑÜ�× Ñ Ó!Ø:×AÑAÄ$ÀuÃ+ÓNõ	
÷ *Õ)ús   –
A&Á&
A4c                 ó   • [        SS9nU R                  UR                  S5        U R                  UR                  5       S5        U R                  [         R                  " S5      R                  S5        U R                  [         R                  " S5      R                  S5        U R                  [         R                  " S5      R                  S5        [        SSS9nU R                  UR                  S5        U R                  UR                  5       S5        [        S	S9nU R                  UR                  S5        U R                  UR                  5       S
5        [        SS9nU R                  UR                  S5        U R                  UR                  5       S5        [        SS9nU R                  UR                  S 5        U R                  UR                  5       S5        [         R                  " S5      nU R                  UR                  S5        [         R                  " S5      nU R                  UR                  S5        g )NÚhttps©r&   Tzhttps://zhttps:Fzhttps:/)r&   r:  z	git+httpszgit+https://Úmailtozmailto:Úztpzztp:zztp://test.comzztp:test:com)r   r+   r:  rf   rd   rŒ   s     r4   Útest_netlocÚTestURL.test_netloc  sª  € ä˜Ñ!ˆØ×Ñ˜Ÿ™¨$Ô/Ø×Ñ˜Ÿ™›¨
Ô3à×ÑœŸš xÓ0×<Ñ<¸eÔDà×ÑœŸš yÓ1×=Ñ=¸uÔEà×ÑœŸš zÓ2×>Ñ>ÀÔEä˜¨eÑ4ˆØ×Ñ˜Ÿ™¨%Ô0Ø×Ñ˜Ÿ™›¨Ô1ä˜Ñ%ˆØ×Ñ˜Ÿ™¨$Ô/Ø×Ñ˜Ÿ™›¨Ô7ä˜Ñ"ˆØ×Ñ˜Ÿ™¨%Ô0Ø×Ñ˜Ÿ™›¨	Ô2ä˜ÑˆØ×Ñ˜Ÿ™¨$Ô/Ø×Ñ˜Ÿ™›¨Ô/ä�mŠmÐ,Ó-ˆØ×Ñ˜Ÿ™¨$Ô/ä�mŠm˜NÓ+ˆØ×Ñ˜Ÿ™¨%Õ0r7   c                 óÂ   • Sn[         R                  " U5      nUR                  S:X  d   eUR                  S:X  d   e[        UR
                     UR                  :w  d   eg )Nz5https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80/z'2001:0db8:85a3:0000:0000:8a2e:0370:7334rC   )r   rd   r)   r9   r   r&   )r/   Útru   s      r4   Útest_ipv6_with_portÚTestURL.test_ipv6_with_port$  sS   € àCˆÜ�mŠm˜AÓˆØ�x‰xÐDÓDÐDÐDØ�x‰x˜2‹~Ðˆ~Ü˜sŸz™zÑ*¨c¯h©hÓ6Ð6Ñ6r7   c                 óh  • Sn[         R                  " U5      nUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR
                  S:X  d   eUR                  S:X  d   eSn[         R                  " U5      nUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR
                  S:X  d   eS	n[         R                  " U5      nUR                  S:X  d   eUR                  S:X  d   eUR                  S
:X  d   eUR
                  S:X  d   eg )Nz3https://user:pass@example.com/path/to/here?k=v#nicerp  ú	user:passúexample.com)r*   ÚtoÚhereÚnicez1https://user:pass@127.0.0.1/path/to/here?k=v#nicez	127.0.0.1z-https://user:pass@[::1]/path/to/here?k=v#nicez::1)r   rd   r&   r:   r)   r*   r.   ©r/   Útextru   s      r4   Ú
test_basicÚTestURL.test_basic,  s(  € àDˆÜ�mŠm˜DÓ!ˆØ�z‰z˜WÓ$Ð$Ð$Ø�|‰|˜{Ó*Ð*Ð*Ø�x‰x˜=Ó(Ð(Ð(Ø�x‰xÐ1Ó1Ð1Ð1Ø�|‰|˜vÓ%Ð%Ð%àBˆÜ�mŠm˜DÓ!ˆØ�z‰z˜WÓ$Ð$Ð$Ø�|‰|˜{Ó*Ð*Ð*Ø�x‰x˜;Ó&Ð&Ð&Ø�x‰xÐ1Ó1Ð1Ð1à>ˆÜ�mŠm˜DÓ!ˆØ�z‰z˜WÓ$Ð$Ð$Ø�|‰|˜{Ó*Ð*Ð*Ø�x‰x˜5Ó Ð Ð Ø�x‰xÐ1Ó1Ð1Ñ1r7   c                 óN   • U R                  [        [        R                  S5        g )Nz#

©r¯   r   r   rd   r`   s    r4   Útest_invalid_urlÚTestURL.test_invalid_urlD  s   € à×Ñœ-¬¯©¸Õ@r7   c                 óN   • U R                  [        [        R                  S5        g )Nzhttp://abc:

/#r…  r`   s    r4   Útest_invalid_authority_urlÚ"TestURL.test_invalid_authority_urlH  s   € à×Ñœ-¬¯©Ð8KÕLr7   c                 óà   • / SQnU Hd  nSU-   S-   nU R                  [        R                  [        [        R                  U5        U R                  [
        [        R                  U5        Mf     g )N)z2001::0234:C1ab::A0:aabc:003Fz2001::1::3FÚ:z::::z::256.0.0.1zhttp://[Ú])r¯   ÚsocketÚerrorr   ÚAF_INET6r   r   rd   )r/   Úinvalid_ipv6_ipsÚiprœ   s       r4   Útest_invalid_ipv6ÚTestURL.test_invalid_ipv6L  sV   € ò
Ðó #ˆBØ! B‘¨Ñ,ˆHØ×ÑœfŸl™l¬I´v·±ÈÔKØ×Ñœm¬S¯]©]¸HÖEò #r7   c                 ó˜   • U R                  [        [        R                  S5        U R                  [        [        R                  S5        g )Nzftp://portmouth:smashz+http://reader.googlewebsite.com:neverforget)r¯   r   r   rd   rh  r`   s    r4   Útest_invalid_portÚTestURL.test_invalid_portZ  s4   € à×Ñœ-¬¯©Ð8OÔPØ×ÑÜÜ�M‰MØ9õ	
r7   c                 ó  • [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        U R                  UR                  5       R	                  5       S5        [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        U R                  UR                  5       R	                  5       S5        g )Nu   http://bÃ¼cher.chu
   bÃ¼cher.chzhttp://xn--bcher-kva.chr   zxn--bcher-kva.chu   https://bÃ¼cher.ch)r   rd   r+   r)   rf   rÞ   rt   rñ   s      r4   Ú	test_idnaÚTestURL.test_idnac  s·   € ä�]Š]Ð.Ó/ˆØ×Ñ˜Ÿ™ ,Ô/Ø×Ñ˜Ÿ™›Ð':Ô;Ø×Ñ˜Ÿ™›×,Ñ,Ó.Ð0IÔJä�]Š]Ð5Ó6ˆØ×Ñ˜Ÿ™Ð"4Ô5Ø×Ñ˜Ÿ™›Ð'AÔBØ×Ñ˜Ÿ™›×,Ñ,Ó.Ð0DÕEr7   c                 ó   • [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        [         R                  " S	5      nU R                  UR                  S
5        U R                  UR	                  5       S	5        [         R                  " S5      nU R                  UR                  S5        U R                  UR	                  5       S5        [        SSSS9nU R                  UR	                  5       S5        [        S
SSSS9nU R                  UR	                  5       S5        [         R                  " S5      nUR                  SS9nU R                  UR	                  5       S5        Sn[         R                  " U5      nUR                  SS9nU R                  UR	                  5       S5        UR                  SS9nU R                  UR	                  5       U5        g )Nzmailto:mahmoud@hatnote.comrr  zhttp://hatnote.comrB   znewscheme:a:b:cÚ	newschemeznewerscheme://a/b/cÚnewerschemez%git+ftp://gitstub.biz/glyph/lefkowitzzgit+ftpz'what+mailto:freerealestate@enotuniq.orgzwhat+mailtors  )ÚxrÚ   ÚzT)r&   r*   r’   z
ztp:/x/y/z)rž  rÚ   rŸ  r   )r&   r*   r’   r:  zgit+ftp:///x/y/z/zfile:///path/to/heckrq  zmailto:/path/to/heckzunregisteredscheme:///a/b/cF)r:  zunregisteredscheme:/a/b/c)r   rd   r+   r&   rf   r´   )r/   ru   Úurl2rœ   Úno_netloc_urlÚ
netloc_urls         r4   Útest_netloc_slashesÚTestURL.test_netloc_slasheso  s_  € ô �mŠmÐ8Ó9ˆØ×Ñ˜Ÿ™ XÔ.Ø×Ñ˜Ÿ™›Ð(DÔEä�mŠmÐ0Ó1ˆØ×Ñ˜Ÿ™ VÔ,Ø×Ñ˜Ÿ™›Ð(<Ô=ô �mŠmÐ-Ó.ˆØ×Ñ˜Ÿ™ [Ô1Ø×Ñ˜Ÿ™›Ð(9Ô:ä�mŠmÐ1Ó2ˆØ×Ñ˜Ÿ™ ]Ô3Ø×Ñ˜Ÿ™›Ð(=Ô>ô �mŠmÐCÓDˆØ×Ñ˜Ÿ™ YÔ/Ø×Ñ˜Ÿ™›Ð(OÔPä�mŠmÐEÓFˆØ×Ñ˜Ÿ™ ]Ô3Ø×ÑØ�K‰K‹MÐDô	
ô ˜ _¸TÑBˆØ×Ñ˜Ÿ™›¨Ô5ô ØØ$ØØñ	
ˆð 	×Ñ˜Ÿ™›Ð(;Ô<ô �mŠmÐ2Ó3ˆØ�{‰{ (ˆ{Ð+ˆØ×Ñ˜Ÿ™›Ð)?Ô@à0ˆÜ�mŠm˜HÓ%ˆØŸ™°˜Ð6ˆØ×Ñ˜×.Ñ.Ó0Ð2MÔNØ—[‘[¨T�[Ð2ˆ
Ø×Ñ˜×+Ñ+Ó-¨xÔ8àr7   c                 óØ   • [        S/S9nU R                  UR                  5       S5        UR                  SS9nU R                  UR                  5       S5        U R	                  X5        g)z}
On host-relative URLs, the C{rooted} flag can be updated to indicate
that the path should no longer be treated as absolute.
ræ   rE  T)r’   z/helloN)r   r+   rf   r´   r}   )r/   ÚaÚbs      r4   Útest_rooted_to_relativeÚTestURL.test_rooted_to_relativeª  sZ   € ô �g�YÑˆØ×Ñ˜Ÿ™› gÔ.Ø�I‰I˜TˆIÐ"ˆØ×Ñ˜Ÿ™› hÔ/Ø×Ñ˜AÕ!r7   c                 ó„  • [        SS/SS9nU R                  UR                  S5        [        S/SS9nU R                  UR                  S5        U R                  X5        [        SS/SS9n[        SS/S9nU R                  X45        U R                  UR                  S5        U R                  UR                  S5        g	)
aÉ  
The C{rooted} flag can be updated in some cases, but it cannot be made
to conflict with other facts surrounding the URL; for example, all URLs
involving an authority (host) are inherently rooted because it is not
syntactically possible to express otherwise; also, once an unrooted URL
gains a path that starts with an empty string, that empty string is
elided and it becomes rooted, because these cases are syntactically
indistinguisable in real URL text.
r   rZ   F)r*   r’   Tr[   )r)   r*   r’   )r)   r*   N)r   r+   r’   )r/   Úrelative_path_rootedÚrelative_flag_rootedÚattempt_unrooted_absoluteÚnormal_absolutes        r4   Útest_autorootedÚTestURL.test_autorooted¶  s¼   € ô  #¨¨U¨¸EÑBÐØ×ÑÐ-×4Ñ4°dÔ;Ü"¨¨¸Ñ=ÐØ×ÑÐ-×4Ñ4°dÔ;Ø×ÑÐ-ÔDä$'¨U¸%¸ÈÑ$OÐ!Ü 5°¨wÑ7ˆØ×ÑÐ2ÔDØ×Ñ˜×/Ñ/°Ô6Ø×ÑÐ2×9Ñ9¸4Õ@r7   c                 ó®  • [        SSSS9n[        SSS9n[        SSSS9nU R                  UR                  S5        U R                  UR                  S5        U R                  UR                  S5        [         R                  " S5      nU R                  [	        U5      [	        U5      5        U R                  [	        U5      [	        U5      5        U R                  UR                  5       UR                  5       5        U R                  X5        U R                  X5        U R                  X5        U R                  X$5        U R                  X45        g)	al  
URLs which include a ``://`` netloc-separator for any reason are
inherently rooted, regardless of the value or presence of the
``rooted`` constructor argument.

They may include a netloc-separator because their constructor was
directly invoked with an explicit host or port, or because they were
parsed from a string which included the literal ``://`` separator.
Úudpi$  F)r&   r9   r’   )r&   r9   Tzudp://:4900N)r   r+   r’   rd   rZ  ÚasText)r/   Údirectly_constructedÚdirectly_constructed_implictÚdirectly_constructed_rootedÚparseds        r4   Ú!test_rooted_with_port_but_no_hostÚ)TestURL.test_rooted_with_port_but_no_hostÍ  s!  € ô  #¨%°dÀ5ÑIÐÜ'*°%¸dÑ'CÐ$Ü&)°¸TÈ$Ñ&OÐ#Ø×ÑÐ-×4Ñ4°dÔ;Ø×ÑÐ5×<Ñ<¸dÔCØ×ÑÐ4×;Ñ;¸TÔBÜ—’˜}Ó-ˆØ×ÑœÐ1Ó2´C¸³KÔ@Ø×ÑœÐ9Ó:¼CÀ»KÔHØ×ÑÐ-×4Ñ4Ó6¸¿¹»ÔHØ×ÑÐ-Ô6Ø×ÑÐ-ÔLØ×ÑÐ-ÔKØ×ÑÐ5Ô>Ø×ÑÐ4Õ=r7   c                 óô   • U R                  [        5         [        [        5        S S S 5        U R                  [        5         [        S5        S S S 5        g ! , (       d  f       N8= f! , (       d  f       g = f)NÚHTTP_____more_like_imHoTTeP)r¯   rh  r   re   r`   s    r4   Útest_wrong_constructorÚTestURL.test_wrong_constructorè  sO   € à×ÑœzÕ*ä”	ŒN÷ +ð ×ÑœzÕ*äÐ-Ô.÷ +Ð*÷ +Õ*ú÷ +Õ*ús   –AÁA)Á
A&Á)
A7c                 ó,  • [         R                  " S5      nUR                  S:X  d   eUR                  SS9nUR	                  5       nUR                  SS9S:X  d   eUR                  SS9S	:X  d   eUR                  5       R                  SS9S
:X  d   eg )Nzhttp://user:pass@example.comr{  zus%20her:passr-  Trl   zhttp://us her:pass@example.comFzhttp://us her:@example.comz http://us%20her:pass@example.com)r   rd   r:   r´   rt   rf   rÞ   ©r/   ru   rv   s      r4   Útest_encoded_userinfoÚTestURL.test_encoded_userinfoñ  s�   € ä�mŠmÐ:Ó;ˆØ�|‰|˜{Ó*Ð*Ð*Ø�k‰k ?ˆkÐ3ˆØ�j‰j‹lˆà�K‰K dˆKÐ+Ð/OÓOð	
ØOà�{‰{¨ˆ{Ð/Ð3OÓOÐOÐOà�J‰J‹L× Ñ ¨tÐ Ð4Ø1ó2ð	
ñ2r7   c                 ó~  • 0 n[         R                  " S5      n[        U5      [        U5      :X  d   eSX'   [         R                  " S5      nUR                  SS5      nSX'   [	        U5      S:X  d   e[        UR                  5       5      S/:X  d   e[        [        5       5      [        [        5       5      :X  d   eg )Nz.http://blog.hatnote.com/ask?utm_source=geocityr
   zhttp://blog.hatnote.com/askÚ
utm_sourceÚgeocityr   )r   rd   ÚhashrÍ   ÚlenÚlistÚvalues)r/   Úurl_mapÚurl1r   s       r4   Ú	test_hashÚTestURL.test_hash   s¡   € àˆÜ�}Š}ÐMÓNˆÜ�D‹zœT $›ZÓ'Ð'Ð'àˆ‰ä�}Š}Ð:Ó;ˆØ�x‰x˜ iÓ0ˆàˆ‰ä�7‹|˜qÓ Ð Ð Ü�G—N‘NÓ$Ó%¨!¨Ó,Ð,Ð,ä”C“E‹{œd¤3£5›kÓ)Ð)Ñ)r7   c                 ó�   • [        5       n[        U5      n[        U5      S:”  d   eSU;  d   eSU;  d   eSU;  d   eSU;  d   eg )Né   r¡   r³  r  r  )r   ÚdirrÆ  )r/   ru   r¢   s      r4   Útest_dirÚTestURL.test_dir  sZ   € ä‹eˆÜ�#‹hˆä�3‹x˜"‹}Ðˆ}à Ó$Ð$Ð$Ø˜sÓ"Ð"Ð"Ø˜cÓ!Ð!Ð!Ø˜cÓ!Ð!Ñ!r7   c                 ó¤   • [         R                  " S5      nUR                  5       S:X  d   eUR                  5       R                  5       S:X  d   eg )Nu"   http://example.com/a%20tÃ©%C3%A9stz&http://example.com/a%20t%C3%A9%C3%A9st)r   r¡   r³  r  rŒ   s     r4   Útest_twisted_compatÚTestURL.test_twisted_compat  sD   € ä�lŠlÐ?Ó@ˆØ�z‰z‹|ÐCÓCÐCÐCØ�y‰y‹{×!Ñ!Ó#Ð'OÓOÐOÑOr7   c                 ó¤   • [         R                  " S5      nUR                  SS5      nUR                  SS5      nUR	                  5       S:X  d   eg )Nzhttp://example.com/?a=b&crž  rÚ   z!http://example.com/?a=b&x=x&c&x=y)r   rd   rÍ   rÇ   rf   rŒ   s     r4   Útest_set_orderingÚTestURL.test_set_ordering%  sH   € ô �mŠmÐ7Ó8ˆØ�g‰g�c˜3ÓˆØ�g‰g�c˜3ÓˆØ�{‰{‹}Ð CÓCÐCÑCr7   c                 óð  • [         R                  " S5      n[         R                  " UR                  5       5      nX:X  d   e[         R                  " UR                  5       R                  5       5      nX:X  d   eX#:X  d   e[         R                  " S5      nUR                  5       nUR                  5       S:X  d   e[         R                  " UR                  5       5      R	                  5       nXV:X  d   eg)zSee issue #4z#urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoobz1first-segment/urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoobz'first-segment/urn:ietf:wg:oauth:2.0:oobN)r   rd   rf   rt   rÞ   )r/   rò   r£   r¤   Úu4Úu5Úu6s          r4   Útest_schemeless_pathÚTestURL.test_schemeless_path0  s¶   € ô �]Š]Ð@ÓAˆÜ�]Š]˜2Ÿ:™:›<Ó(ˆØ‹xˆˆxä�]Š]˜2Ÿ9™9›;×.Ñ.Ó0Ó1ˆØ‹xˆˆxØ‹xˆˆxô �]Š]ÐNÓOˆØ�Y‰Y‹[ˆØ�z‰z‹|ÐHÓHÐHÐHä�]Š]˜2Ÿ:™:›<Ó(×/Ñ/Ó1ˆØ‹xˆ‰xr7   c                 óp   • [         R                  " S5      nUR                  5       nUR                  5         g)z4See issue #7, affecting only narrow builds (2.6-3.3)zhttps://xn--vi8hiv.wsN)r   rd   rt   rf   r¿  s      r4   Útest_emoji_domainÚTestURL.test_emoji_domainC  s'   € ô �mŠmÐ3Ó4ˆØ�j‰j‹lˆØ�‰�r7   c                 óÎ   • U R                  [        [        SSS9  U R                  [        [        SS9  U R                  [        [        SS9  U R                  [        [        SS9  g	)
zPer issue #6 and #8rB   za/c)r&   r)   )Ú?rE  )Ú#)Ú&ro   rè   N)r¯   rh  r   r`   s    r4   Útest_delim_in_paramÚTestURL.test_delim_in_paramK  sZ   € ð 	×Ñœ*¤c°&¸uÐÑEØ×Ñœ*¤c°ÐÑ7Ø×Ñœ*¤c°ÐÑ7Ø×Ñœ*¤c°-ÐÒAr7   c                 óœ  • [         R                  " S5      n[         R                  " S5      nX:X  d   e[         R                  " S5      n[         R                  " S5      nX:X  d   e[         R                  " S5      n[         R                  " S5      nX:X  d   e[         R                  " S5      n[         R                  " S5      nX:X  d   eg )Nzhttp://example.com/zhttp://example.com)r   rd   rñ   s      r4   Útest_empty_paths_eqÚTestURL.test_empty_paths_eqS  sž   € ä�]Š]Ð0Ó1ˆÜ�]Š]Ð/Ó0ˆà‹xˆˆxä�]Š]Ð/Ó0ˆÜ�]Š]Ð/Ó0ˆà‹xˆˆxä�]Š]Ð/Ó0ˆÜ�]Š]Ð0Ó1ˆà‹xˆˆxä�]Š]Ð0Ó1ˆÜ�]Š]Ð0Ó1ˆà‹xˆ‰xr7   c                 óô   • [         R                  " S5      R                  S:X  d   eU R                  [        [         R                  S5        U R                  [        [         R                  [        5       5        g )Nz#okÚoks   bytes://x.y.z)r   rd   r.   r¯   rb  rþ   r`   s    r4   Útest_from_text_typeÚTestURL.test_from_text_typei  sN   € ä�}Š}˜UÓ#×,Ñ,°Ó4Ð4Ð4Ø×Ñœ)¤S§]¡]Ð4DÔEØ×Ñœ)¤S§]¡]´F³HÕ=r7   c                 ó
  • U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        g )Nzhttp://[::1/zhttp://::1]/zhttp://[[::1]/zhttp://[::1]]/zhttp://127.0.0.1:zhttp://127.0.0.1:hizhttp://127.0.0.1::80r…  r`   s    r4   Útest_from_text_bad_authorityÚ$TestURL.test_from_text_bad_authorityo  s¥   € ð 	×Ñœ-¬¯©¸ÔGØ×Ñœ-¬¯©¸ÔGØ×Ñœ-¬¯©Ð8HÔIØ×Ñœ-¬¯©Ð8HÔIð 	×Ñœ-¬¯©Ð8KÔLà×Ñœ-¬¯©Ð8MÔNà×Ñœ-¬¯©Ð8NÕOr7   c                 ó.  • [         R                  " S5      nUR                  S5      / :X  d   eUR                  S5      S/:X  d   e[        UR                  5      S:X  d   eUR                  5       nUR                  S:X  d   eUR                  S:X  d   eUR                  S:X  d   eUR                  S5      S	/:X  d   eUR                  S
:X  d   eUR                  5       S:X  d   eUR                  SSSSSS9nX1:X  d   e[         R                  " S5      nUR                  5       nUR                  5       S:X  d   e[         R                  " S5      nUR                  5       nUR                  5       S:X  d   e[        SS9R                  SS9R                  5       S:X  d   e[        SS9R                  5       R                  5       S:X  d   e[        SSS/S/SSS9nUR                  SS9S :X  d   eUR                  5       R                  SS9S!:X  d   eg )"Nz0HTTP://Example.com/A%61/./../A%61?B%62=C%63#D%64ÚBbzB%62zC%63é   rB   r|  )ÚAaÚCcÚDdzhttp://example.com/Aa?Bb=Cc#DdFr^   zhttp://example.iozhttp://example.io/z/a%2fb/cd%3f?k%3d=v%23#testz/a%2Fb/cd%3F?k%3D=v%23#test)r   z%te%stsrE  )Úpercentsz/%te%stsz/%25te%25stsÚftpz%%%z%a%b)Ú%z%%rù  z%:%)r&   r*   r-   r.   r:   Trl   zftp://%:%@/%%%/%a%b?%=%%#%z0ftp://%25:%25@/%25%25%25/%25a%25b?%25=%25%25#%25)
r   rd   rÝ   rÆ  r*   Ú	normalizer&   r)   r.   rf   )	r/   ru   Únorm_urlÚnoop_norm_urlÚslashless_urlÚslashful_urlÚdelimited_urlÚnorm_delimited_urlÚpercenty_urls	            r4   Útest_normalizeÚTestURL.test_normalize  sH  € ä�mŠmÐNÓOˆØ�w‰w�t‹} Ó"Ð"Ð"Ø�w‰w�v‹ 6 (Ó*Ð*Ð*Ü�3—8‘8‹} Ó!Ð!Ð!ð —=‘=“?ˆà�‰ &Ó(Ð(Ð(Ø�}‰} Ó-Ð-Ð-Ø�}‰} Ó'Ð'Ð'Ø�|‰|˜DÓ! d VÓ+Ð+Ð+Ø× Ñ  DÓ(Ð(Ð(Ø×ÑÓ!Ð%EÓEÐEÐEð Ÿ™Ø˜u¨5¸Èð &ð 
ˆð Ó#Ð#Ð#ô ŸšÐ&9Ó:ˆØ$×.Ñ.Ó0ˆØ×#Ñ#Ó%Ð)=Ó=Ð=Ð=ô ŸšÐ&CÓDˆØ*×4Ñ4Ó6ÐØ!×)Ñ)Ó+Ð/LÓLÐLÐLô �_Ñ%×/Ñ/¸Ð/Ð?×GÑGÓIØóð	
ðô ˜Ñ(×2Ñ2Ó4×<Ñ<Ó>À.ÓPÐPÐPäØØ˜�Ø�-ØØñ
ˆð × Ñ ¨tÐ Ð4Ø+ó,ð	
ð,ð ×"Ñ"Ó$×,Ñ,¸4Ð,Ð@ØAóBð	
ñBr7   c                 ó�  • Sn[         R                  " U5      n[        U5      U:X  d   e[        U5      S:X  d   e[        (       aA  [        [        U5      [        5      (       d   e[        [        U5      [        5      (       d   eg [        [        U5      [        5      (       d   e[        [        U5      [        5      (       d   eg )Nu&   http://example.com/Ã¡/y%20a%20y/?b=%25s*   http://example.com/%C3%A1/y%20a%20y/?b=%25)r   rd   r'   rg  ÚPY2r%   rZ  r€  s      r4   Útest_strÚTestURL.test_str¸  s�   € ð 8ˆÜ�mŠm˜DÓ!ˆÜ�s‹|˜tÓ#Ð#Ð#Ü�S‹zÐJÓJÐJÐJçŠ3Üœc #›h¬×.Ñ.Ð.Ð.Üœg c›l¬G×4Ñ4Ð4Ñ4äœc #›h¬×0Ñ0Ð0Ð0Üœe C›j¬%×0Ñ0Ð0Ñ0r7   c                 ó@  • [         R                  " S5      nUR                  5       R                  S:X  d   eUR	                  5       R                  S:X  d   e[         R                  " S5      nUR                  5       R                  S:X  d   eUR	                  5       R                  S:X  d   eUR	                  5       R                  5       R                  S:X  d   eSn[         R                  " U5      R	                  5       R                  5       R                  S:X  d   eg )	Nu   http://abÃ©.com/u   abÃ©.comzxn--ab-cja.comu(   http://ãƒ‰ãƒ¡ã‚¤ãƒ³.ãƒ†ã‚¹ãƒˆ.co.jp#testu   ãƒ‰ãƒ¡ã‚¤ãƒ³.ãƒ†ã‚¹ãƒˆ.co.jpzxn--eckwd4c7c.xn--zckzah.co.jpzhttp://Example.comr|  )r   rd   rt   r)   rÞ   Úget_decoded_url)r/   ru   r�  s      r4   Útest_idna_cornersÚTestURL.test_idna_cornersÈ  så   € ä�mŠmÐ.Ó/ˆØ�z‰z‹|× Ñ  JÓ.Ð.Ð.Ø�z‰z‹|× Ñ Ð$4Ó4Ð4Ð4ä�mŠmÐFÓGˆØ�z‰z‹|× Ñ Ð$BÓBÐBÐBØ�z‰z‹|× Ñ Ð$DÓDÐDÐDà�z‰z‹|×+Ñ+Ó-×2Ñ2Ð6TÓTÐTÐTà#ˆä�MŠM˜$Ó×&Ñ&Ó(×8Ñ8Ó:×?Ñ?À=ÓPð	
ÙPr7   rM  N)r   )QrT  rU  rV  rW  Ú__doc__r5   r>   rF   rS   rW   ra   ri   rq   rz   r~   r�   r†   r�   r”   r—   r�   r¥   r¬   r±   rµ   r¿   rÈ   rÎ   rÖ   rß   râ   ré   rí   ró   rú   rÿ   r  r  r
  r  r  r  r"  r&  r)  r0  r4  r7  r<  rB  rF  rj  rm  rt  rx  r‚  r†  r‰  r“  r–  r™  r£  r¨  r¯  r¸  r¼  rÀ  rË  rÐ  rÓ  rÖ  rÜ  rß  rå  rè  rì  rï  r  r  r
  rX  rM  r7   r4   r!   r!   ‘   s�  † ñò=ð6 ô1+òf+ò
ò&	
ò
ò(7ò+òò
ò 

ò
ò0	
òEò+ò
ò&<Cò|BòEò5ò((òT%
òN
ò,
ò2>ò*.ò6òò!ò	$ò	)ò5ò:ò9òMò
ò4
ò0
ò&6ò 1ò
ò.Lò
ò
Gò.ò7òSAòj
ò 1òD7ò2ò0AòMòFò
ò
Fò9òv
"òAò.>ò6/ò
ò*ò$
"òPòDòò&òBòò,>òPò 7
òr1õ 
r7   r!   )Ú
__future__r   ÚsysrŽ  Útypingr   r   r   r   r   r	   Úcommonr   r   r   r   Ú_urlr   r   Úversion_infor  r,   r'   re   r¨   r©   rn   r!   rM  r7   r4   Ú<module>r     so   ðõ (ã 
Û ß =× =å %ß !ß -ð 
×Ñ�qÑ˜QÑ€Ù
ˆr‹(€ð 9€	ð 2Ð ò1Ð ðhA€ôHF
Ðõ F
r7   