+
    m4i?                     p   ^ RI Ht ^ RIt^ RIt^ RIHtHtHtHtH	t	H
t
 ^RIHt ^RIHtHt ^RIHtHt ]P&                  ^ ,          ^8H  t]! R4      tRtR	t. RNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0NR1NR2NR3NtR4t ! R
 R]4      tR# )5    )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?qc                     a  ] tR t^t o RtR tROR ltR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R  t#R! t$R" t%R# t&R$ t'R% t(R& t)R' t*R( t+R) t,R* t-R+ t.R, t/R- t0R. t1R/ t2R0 t3R1 t4R2 t5R3 t6R4 t7R5 t8R6 t9R7 t:R8 t;R9 t<R: t=R; t>R< t?R= t@R> tAR? tBR@ tCRA tDRB tERC tFRD tGRE tHRF tIRG tJRH tKRI tLRJ tMRK tNRL tORMtPV tQRN# )PTestURLz
Tests for L{URL}.
c                   T P                  \        VP                  \        4      ;'       g    VP                  RJ \	        V4      4       T P                  \        VP
                  \        4      ;'       g    VP
                  RJ \	        V4      4       VP                   F,  pV P                  \        V4      \        \	        V4      4       K.  	  VP                   Fc  w  r4V P                  \        X4      \        \	        V4      4       T P                  VRJ ;'       g    \        V\        4      \	        V4      4       Ke  	  V P                  \        VP                  4      \        \	        V4      4       R# )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   &&   9/usr/lib/python3/dist-packages/hyperlink/test/test_url.pyassertUnicodedTestURL.assertUnicoded   s     	qxx)==QXX-=tAw	
 	
16673EEqvv~tAwO66CT#Ya9 wwGRT#Ya9OOAI??Aw)?aI  	ajj)7DG<    c	                   VP                   VP                  VP                  VP                  VP                  VP
                  VP                  3p	VV\        V4      \        V4      VVVP                  3p
V P                  W4       R# )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    r!   r   r   r   r   r   r*   r+   actualexpecteds   &&&&&&&&&  r%   	assertURLTestURL.assertURL   sw    @ HHFFFFGGJJFFJJ
 $K%LJJ
 	*r(   c           	        a  V 3R lpV! \        RR4      4       V! \        RR. . 4      4       V! \        RR. . R4      4       R# )z0
L{URL} should have appropriate default values.
c           
      Z   < SP                  V 4       SP                  V R R. . R^PR4       R# )httpr   N)r&   r/   )r!   r    s   &r%   check(TestURL.test_initDefaults.<locals>.check   s+    "NN1fb"b"b"=r(   r3   r   N)r   )r    r4   s   f r%   test_initDefaultsTestURL.test_initDefaults   s@    	>
 	c&"oc&"b"%&c&"b"b)*r(   c           	         \        RRR.R
R.R4      pV P                  V4       V P                  VRRR.R
R.RR4       V P                  \        RRR.R.R	4      RRR.R.R	^P4       R# )z-
L{URL} should accept L{unicode} parameters.
shpNfr3      à   éu   ⊥kr$   )r@   N)u   λu   πr   r&   r/   r    r!   s   & r%   	test_initTestURL.test_init   s    
 S3%*k!:C@Aq#sSEJ+Dc4P+?*@(KH!"	
r(   c           	         \        RRR.RR.R4      pV P                  V4       V P                  VRRR.RR.RR4       R# )z>
L{URL} should accept (and not interpret) percent characters.
r9   z%68z%70Nz%66)%6Bz%76)rF   NrA   rB   s   & r%   test_initPercentTestURL.test_initPercent   sM    
 UUGnm%DeLAsEE7^]$CUD	
r(   c                z    V P                  \        \        RRR.R
R.RR7      4      R\        R4      : R	24       R# )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.
r3   foobarNfrobr   r   r   r   r   zURL.from_text(zhttp://foo/bar?baz&k=v#frob))bazNr?   )r   r   r   r    s   &r%   	test_reprTestURL.test_repr  sF     	!(*5# $((E#FH	
r(   c                    \         P                  ! \        4      pV P                  \        VP	                  4       4       R# )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   & r%   test_from_textTestURL.test_from_text  s)     --	*GOO$56r(   c                    \          F:  p\        P                  ! V4      P                  RR7      pV P	                  W4       K<  	  R# )z0
L{URL.to_text} should invert L{URL.from_text}.
Twith_passwordN)ROUNDTRIP_TESTSr   rT   rV   r   )r    testresults   &  r%   test_roundtripTestURL.test_roundtrip%  s8    
 $D]]4(00t0DFT* $r(   c                    \          Fm  p\        P                  ! V4      pVP                  4       pVP                  4       pW48X  g   Q hVP	                  R R7      pVP	                  R R7      pWV8X  d   Km  Q h	  R# )Tr\   N)r^   r   rT   to_irirV   )r    r_   urliri
double_iriiri_textdouble_iri_texts   &      r%   test_roundtrip_double_iri!TestURL.test_roundtrip_double_iri.  sp    #D--%C**,CJ$$${{{6H(00t0DO... $ 	r(   c                    \         P                  ! \        4      pV P                  V\         P                  ! \        4      4       V P	                  V\         P                  ! R4      4       R# )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   rT   rU   r   assertNotEqualrW   s   & r%   test_equalityTestURL.test_equality;  sK     --	*#--	":;MMO	
r(   c                    V P                  \        RR7      \        4       4       V P                  \        P                  ! R4      \        P                  ! R4      4       R# )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/#http://localhost/N)r   r   rT   rP   s   &r%   test_fragmentEqualityTestURL.test_fragmentEqualityK  sC     	b)351MM./MM-.	
r(   c                   \         P                  ! \        4      pV P                  RVP	                  R4      P                  4       4       V P                  RVP	                  R4      P                  4       4       V P                  RVP	                  R4      P                  4       4       V P                  RVP	                  R4      P                  4       4       R	# )
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   rT   rU   r   childrV   rW   s   & r%   
test_childTestURL.test_childW  s     --	*<MM&!))+	
 	?MM'"**,	
 	EMM-(002	
 	HMM.)113	
r(   c                    \         P                  ! R4      pV P                  VP                  RRR4      P	                  4       R4       R# )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   rT   r   rv   rV   r    re   s   & r%   test_multiChildTestURL.test_multiChildo  s=     mm45IIc3$,,.0N	
r(   c                    \        RR7      P                  R4      pV P                  VP                  4       V P	                  RVP                  4       4       R# )zW
L{URL.child} of a L{URL} without a path produces a L{URL} with a single
path segment.
www.foo.comr   rz   zhttp://www.foo.com/cN)r   rv   r   rootedr   rV   )r    childURLs   & r%   test_childInitRootTestURL.test_childInitRootz  sC     M*005(/1A1A1CDr(   c                ^    \        RR7      pV P                  VP                  4       V4       R# )zD
L{URL.child} without any new segments returns the original L{URL}.
r   r   N)r   r   rv   r}   s   & r%   test_emptyChildTestURL.test_emptyChild  s$    
 }%c*r(   c                &   \         P                  ! \        4      pV P                  RVP	                  R4      P                  4       4       Rp\         P                  ! V4      pV P                  RVP	                  R4      P                  4       4       R# )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   rT   rU   r   siblingrV   )r    rX   url_texts   &  r%   test_siblingTestURL.test_sibling  ss     --	*>OOH%--/	

 ?--)9OOH%--/	
r(   c                   \         P                  ! \        4      pV P                  RVP	                  R4      P                  4       4       V P                  RVP	                  R4      P                  4       4       V P                  RVP	                  R4      P                  4       4       V P                  RVP	                  R4      P                  4       4       V P                  R	VP	                  R
4      P                  4       9  4       \         P                  ! R4      pV P                  RVP	                  R4      P                  4       4       \         P                  ! R4      pV P                  VP	                  R4      P                  4       R4       \         P                  ! R4      pRpV P                  VP	                  R4      P                  4       V4       V P                  VP	                  4       P                  4       V4       \         P                  ! R4      p\         P                  ! R4      pVP	                  V4      pV P                  VP                  4       R4       R# )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=defrK   zhttp://localhost/foo/barN)r   rT   rU   r   r   rV   r   fromText)r    rX   r!   resu2u3s   &     r%   
test_clickTestURL.test_click  s    --	*8MM"%%'	

 	2MM'"**,	

 	&h(?(G(G(I	
 	2MM'"**,	
 	==!<=EEGH	
 MM9:/GG%&..0	
 MM89GG+,4468O	

 MM@A),,.4 	**,c2 LL89]]5!WWR['ABr(   c                    \         P                  ! \        4      p\         F4  w  r#V P	                  VP                  V4      P                  4       V4       K6  	  R# )zA
L{URL.click} should correctly resolve the examples in RFC 3986.
N)r   rT   relativeLinkBaseForRFC3986relativeLinkTestsForRFC3986r   r   rV   )r    baserefr.   s   &   r%   test_clickRFC3986TestURL.test_clickRFC3986  s@    
 }}78:OSTZZ_446A  ;r(   c                    \         P                  ! \        4      pV P                  \        VP
                  R4       V P                  \        VP
                  R4       R# )z=
L{URL.click} should not accept schemes with relative paths.
zg:hzhttp:hN)r   rT   r   assertRaisesNotImplementedErrorr   )r    r   s   & r%   test_clickSchemeRelPathTestURL.test_clickSchemeRelPath  sA    
 }}78-tzz5A-tzz8Dr(   c           
     6   \         P                  ! R4      pV P                  VP                  VP                  VP
                  VP                  VP                  VP                  VP                  4      V4       V P                  VP                  4       V4       R# )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   rT   r   replacer   r   r   r   r   r*   rW   s   & r%   test_cloneUnchangedTestURL.test_cloneUnchanged  sw     -- 56OO   
	
 	*G4r(   c                4   . RO. RO. RO. RO. RO. R	O. R
O. RO. RO. RO. RO. RO. RO.pV Fh  w  r#p\         P                  ! V4      P                  V4      P                  4       pV P	                  VVRP                  V\        V4      VVR7      4       Kj  	  R# )zL
L{URL.click} collapses C{.} and C{..} according to RFC 3986 section
5.2.4.
z1{start}.click({click}) => {actual} not {expected})startr   r-   r.   N)rq   .rq   )rq   ..rq   )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//e)r   rT   r   rV   r   formatr   )r    testsr   r   r.   r-   s   &     r%   test_clickCollapseTestURL.test_clickCollapse  s     <<DCKJHI
 IK
 L+
. ',"E(]]5)//6>>@FCJJu+!%	 K 	 ',r(   c                p   V P                  R\        P                  ! R4      P                  RR4      P	                  4       4       V P                  R\        RR7      P                  RR4      P	                  4       4       \        P                  ! \
        4      pV P                  RVP                  R	4      P	                  4       4       V P                  R
VP                  R	R4      P	                  4       4       V P                  RVP                  R	R4      P                  R4      P	                  4       4       V P                  RVP                  R4      P                  R	R4      P	                  4       4       V P                  RVP                  R	R4      P                  RR4      P	                  4       4       R# )z#
L{URL.add} adds query parameters.
z'http://www.foo.com/a/nice/path/?foo=barzhttp://www.foo.com/a/nice/path/rJ   rK   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   rT   addrV   rU   rW   s   & r%   test_queryAddTestURL.test_queryAdd-  sg   
 	5MM;<SWY		
 	)]#''u5==?	
 --	*=KK'')	
 	AKK&..0	
 	FKK&**62::<	

 	FKK##FE2::<	

 	HKK&**5$7??A	
r(   c                   \         P                  ! \        4      pV P                  RVP	                  RR4      P                  4       4       V P                  RVP	                  R4      P	                  RR4      P                  4       4       V P                  RVP                  RR4      P	                  RR4      P                  4       4       R# )	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   rT   rU   r   setrV   r   rW   s   & r%   test_querySetTestURL.test_querySetT  s    
 --	*8KKt$,,.	

 	>KK""5*5==?	
 	8KKu%))%6>>@	
r(   c                   \         P                  ! R4      pV P                  VP                  R4      \         P                  ! R4      4       V P                  VP                  RRR7      \         P                  ! R4      4       V P                  VP                  R^R7      \         P                  ! R4      4       V P                  VP                  RR^ R7      \         P                  ! R4      4       R	# )
z7
L{URL.remove} removes instances of a query parameter.
z*https://example.com/a/b/?foo=1&bar=2&foo=3rJ   zhttps://example.com/a/b/?bar=21)namevaluez$https://example.com/a/b/?bar=2&foo=3)r   limit)r   r   r   N)r   rT   r   remover}   s   & r%   test_queryRemoveTestURL.test_queryRemovej  s    
 mmHIJJus}}-MN	
 	JJEJ-MM@A	

 	JJEJ+MM@A	

 	JJEAJ6MMFG	
r(   c                J   \         P                  ! R4      pV P                  VP                  R4      R.4       V P                  VP	                  4       R4       \         P                  ! R4      pV P                  VP
                  R	4       V P                  VP	                  4       R4       \         P                  ! R4      pVP                  4       pV P                  VP                  R4      R.4       V P                  VP                  4       P                  R4      R.4       R# )
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=yz7https://example.com/?argument=3&argument=4&operator=%3Doperator=N))rJ   r   )rK   y)r   rT   r   getrV   r   rd   to_uri)r    r!   rf   s   &  r%   test_parseEqualSignInParamValue'TestURL.test_parseEqualSignInParamValue  s     MM45rWI.&@AMM=>"BC&IJMME
 hhj,se4))*5u=r(   c                V    V P                  \        4       P                  4       R4       R# )z7
An empty L{URL} should serialize as the empty string.
r   N)r   r   rV   rP   s   &r%   
test_emptyTestURL.test_empty  s    
 	"-r(   c                `    \        R.R7      pV P                  VP                  4       R4       R# )z@
An L{URL} with query text should serialize as just query text.
r   z?hello=worldNhelloworld)r   r   rV   rB   s   & r%   test_justQueryTextTestURL.test_justQueryText  s(    
 )*+n5r(   c                T    \         P                  ! R4      pV P                  W4       R# )z"
L{URL} compares equal to itself.
rq   Nr   rT   r   rB   s   & r%   test_identicalEqualTestURL.test_identicalEqual  s!    
 MM-.r(   c                    \         P                  ! R4      p\         P                  ! R4      pV P                  W4       R# )z7
URLs with equivalent components should compare equal.
%http://u@localhost:8080/p/a/t/h?q=p#fNr   r    u1r   s   &  r%   test_similarEqualTestURL.test_similarEqual  s0    
 ]]BC]]BC r(   c                    \         P                  ! R4      p\         P                  ! R4      pV P                  W8H  V: RV: 24       V P                  W4       R# )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   rT   assertFalserm   r   s   &  r%   test_differentNotEqualTestURL.test_differentNotEqual  sG     ]]/0]]/0R#89B#r(   c                    \         P                  ! R4      pV P                  V^*8H  R4       V P                  V\        4       8H  R4       V P	                  V^*4       V P	                  V\        4       4       R# )z-
L{URL} is not equal (C{==}) to other types.
rq   zURL must not equal a number.zURL must not equal an object.N)r   rT   r   objectrm   rB   s   & r%   test_otherTypesNotEqualTestURL.test_otherTypesNotEqual  sa    
 MM-.b"@Afh(GHAr"Avx(r(   c                h    \         P                  ! R4      pV P                  W8g  RV,          4       R# )z:
Identical L{URL}s are not unequal (C{!=}) to each other.
r   z%r == itselfNr   rT   r   rB   s   & r%   test_identicalNotUnequal TestURL.test_identicalNotUnequal  s*    
 MMAB!!34r(   c                    \         P                  ! R4      p\         P                  ! R4      pV P                  W8g  V: RV: 24       R# )zE
Structurally similar L{URL}s are not unequal (C{!=}) to each other.
r    == Nr   r   s   &  r%   test_similarNotUnequalTestURL.test_similarNotUnequal  s9    
 ]]BC]]BCR#89r(   c                    \         P                  ! R4      p\         P                  ! R4      pV P                  W8g  V: RV: 24       R# )zC
Structurally different L{URL}s are unequal (C{!=}) to each other.
r   r   r   N)r   rT   r   r   s   &  r%   test_differentUnequalTestURL.test_differentUnequal  s7    
 ]]/0]]/0B"78r(   c                    \         P                  ! R4      pV P                  V^*8g  R4       V P                  V\        4       8g  R4       R# )z+
L{URL} is unequal (C{!=}) to other types.
rq   zURL must differ from a number.z"URL must be differ from an object.N)r   rT   r   r   rB   s   & r%   test_otherTypesUnequalTestURL.test_otherTypesUnequal  s;    
 MM-.R!ABVX'KLr(   c                j   Rp\         P                  ! V4      pVP                  4       pV P                  VP                  R4       V P                  VP
                  ^ ,          R4       V P                  VP                  4       V4       RpVP                  4       pV P                  WTV: RV: 24       R# )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   é.comu   é.http://xn--9ca.com/%C3%A9?%C3%A1=%C3%AD#%C3%BAr   N)r   rT   asURIr   r   r   rV   )r    unicodeyrf   uriexpectedURI	actualURIs   &     r%   
test_asURITestURL.test_asURI  s    B 	 mmH%iik#LMHHQKM	
 	1FKKM	)[$I	
r(   c                j   Rp\         P                  ! V4      pVP                  4       pV P                  VP                  R4       V P                  VP
                  ^ ,          R4       V P                  VP                  4       V4       RpVP                  4       pV P                  WTV: RV: 24       R# )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.comz%C3%A9u   http://é.com/é?á=í#úr   N)r   rT   asIRIr   r   r   rV   )r    asciiishr  rf   expectedIRI	actualIRIs   &     r%   
test_asIRITestURL.test_asIRI  s     DmmH%iik=1!h/13 	 KKM	)[$I	
r(   c                    Rp\         P                  ! V4      pVP                  4       pRpVP                  4       pV P	                  WTV: RV: 24       R# )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   rT   r  rV   r   )r    urlWithBinaryr  rf   r  r  s   &     r%   test_badUTF8AsIRITestURL.test_badUTF8AsIRI#  sQ     ;mmM*iik2 	
 KKM	)[$I	
r(   c                    Rp\         P                  ! V4      pVP                  4       pV P                  VP	                  4       V4       R# )zD
A L{URL} composed of non-ASCII text will result in non-ASCII text.
r  N)r   rT   r  r   rV   )r    r  rf   alsoIRIs   &   r%   test_alreadyIRIAsIRITestURL.test_alreadyIRIAsIRI6  s?    B 	 mmH%))+*H5r(   c                    Rp\         P                  ! V4      pVP                  4       P                  4       pV P	                  W14       R# )z8
A L{URL} composed of encoded text will remain encoded.
r  N)r   rT   r  rV   r   )r    r  r  r  s   &   r%   test_alreadyURIAsURITestURL.test_alreadyURIAsURIF  s:    
 GmmK(IIK'')	0r(   c                   \         P                  ! R4      pV P                  VP                  R4      R4       V P                  VP                  R4      R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  VP                  4       R4       V P                  VP                  RR	7      P                  4       R
4       R# )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   rT   r   	authorityr+   userrV   r   r}   s   & r%   test_userinfoTestURL.test_userinfoP  s     mmJ
 	MM$!D	
 	u-/FG'>?:.KKMM	
 	KKK,446=	
r(   c                    \         P                  ! R4      pV P                  VP                  R4       V P                  VP	                  4       R4       R# )z:
L{URL.from_text} parses custom port numbers as integers.
zhttp://www.example.com:8080/i  N)r   rT   r   r*   rV   )r    portURLs   & r%   test_portTextTestURL.test_portTextg  s?    
 -- >?t,*,JKr(   c                n    V P                  \        P                  ! R4      P                  4       R4       R# )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   rT   rV   rP   s   &r%   test_mailtoTestURL.test_mailtop  s+     	MM34<<>%	
r(   c                   \         P                  ! R4      pV P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  VP                  4       R4       R# )zR
An HTTP URL without a hostname, but with a path, should also round-trip
cleanly.
zhttp:relative-pathr   FN)zrelative-path)r   rT   r   r   r   uses_netlocrV   )r    without_hosts   & r%   test_httpWithoutHostTestURL.test_httpWithoutHost}  sp     }}%9:**B/**,>?1159--/1EFr(   c                    Rp\        R.R7      pV P                  VP                  V4       \        RR/R7      pV P                  VP                  V4       R# )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   Nr1  r2  )r3  )r   r   r   )r    r.   re   s   &  r%   test_queryIterableTestURL.test_queryIterable  sN     (*+,H-&)*H-r(   c                Z    \        RR.R7      pV P                  VP                  R4       R# )zZ
When a L{URL} is created with a C{path} argument, the C{path} is
converted into a tuple.
r   r   r   Nr   )r   r   r   r}   s   & r%   test_pathIterableTestURL.test_pathIterable  s(     )*#56r(   c           
     >  a aa  ! R R\         4      o\        \        J d   RMRpV 3R loV3VVV 3R llpV! R4       V! R4       V! R	4       V! R
R4       V! R4       V! RR4       S P                  \        4      ;_uu_ 4       p\        \        \        S! 4       4      .R7       RRR4       S! XVR4       S P                  \        4      ;_uu_ 4       p\        R\        \        S! 4       4      3.R7       RRR4       S! W1R,           R4       S P                  \        4      ;_uu_ 4       p\        \        \        S! 4       4      R3.R7       RRR4       S! W1R4       S P                  \        4      ;_uu_ 4        \        \        \        \        \        3,          S! 4       4      .R7       RRR4       S P                  \        4      ;_uu_ 4        \        \        \        \        \        3,          R4      .R7       RRR4       S P                  \        4      ;_uu_ 4        \        \        \        \        \        3,          R4      .R7       RRR4       \
        P                  ! R4      pS P                  \        4      ;_uu_ 4       pVP                  \        \        S! 4       4      4       RRR4       S! W1R4       S P                  \        4      ;_uu_ 4       pVP                  \        \        S! 4       4      4       RRR4       S! W1R4       S P                  \        4      ;_uu_ 4       pVP                  \        \        S! 4       4      4       RRR4       S! W1R4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELN; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL:; i  + '       g   i     L; i  + '       g   i     L; i)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                   ,   a  ] tR tRt o R tR tRtV tR# )1TestURL.test_invalidArguments.<locals>.Unexpectedi  c                    R # )wrong rP   s   &r%   __str__9TestURL.test_invalidArguments.<locals>.Unexpected.__str__  s    r(   c                    R # )<unexpected>r?  rP   s   &r%   __repr__:TestURL.test_invalidArguments.<locals>.Unexpected.__repr__  s    %r(   r?  N)__name__
__module____qualname____firstlineno__r@  rD  __static_attributes____classdictcell____classdict__s   @r%   
Unexpectedr<    s     & &r(   rN  r   strc                 r   < SP                  \        V P                  4      R P                  WR4      4       R# )zexpected {0} for {1}, got {2}rC  N)r   rO  	exceptionr   )raisedexpectationr   r    s   &&&r%   assertRaised3TestURL.test_invalidArguments.<locals>.assertRaised  s2    F$$%/66~r(   c           	         < SP                  \        4      ;_uu_ 4       p\        R/ V S! 4       /B  R R R 4       S! XW4       R #   + '       g   i     L; i)Nr?  )r   	TypeErrorr   )paramrS  rR  rN  rT  r    s   && r%   r4   ,TestURL.test_invalidArguments.<locals>.check  sB    ""9--,ujl+, . 4 .-s   AA	r   r   r   r   boolr+   r*   zint or NoneTyper7  Nzpath segmentr   r   z or NoneTypezquery parameter valuer   zquery parameter namezhttps://valid.example.com/zrelative URL)r@   r$   vv)r@   )r   bytesrO  r   rW  r   r	   r   r   
ValueErrorrT   rv   r   r   )r    defaultExpectationr4   rR  re   rN  rT  s   f    @@r%   test_invalidArgumentsTestURL.test_invalidArguments  s   	& 	& +03,YE	 &8 	5 	5 	hfjhjf'(y))Vd4./0 * 	V/@y))VT:< 89:; * 	79P	
 y))VT:<0':;< * 	V1GH y))tE$*-z|<=> * z**tE$*-/?@AB + z**tE$*-v678 + mm89y))VIId4./ *V@y))VKKT:<01 *V@y))VIId4./ *V@K *))
 *)) *)) *)) +** +** *)) *) *)sl   !M-#N-#N>2N)-N='-O%O%"%O95%P-M>	N	N&	)N:	=O	O"	%O6	9P		P	c                
   V P                  \        4      ;_uu_ 4       p\        RR7       RRR4       V P                  \	        XP
                  4      RP                  \        R4      4      4       R#   + '       g   i     LO; i)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.
rJ   r7  Nz,expected iterable of text for path, not: {0})r   rW  r   r   rO  rQ  r   r   )r    rR  s   & r%   !test_technicallyTextIsIterableBut)TestURL.test_technicallyTextIsIterableBut  sZ     y))VUO *  !:AA$u+N	
 *)s   A22B	c                   \        R R7      pV P                  VP                  R4       V P                  VP                  4       R4       V P                  \         P                  ! R4      P                  R4       V P                  \         P                  ! R4      P                  R4       V P                  \         P                  ! R4      P                  R4       \        R RR7      pV P                  VP                  R4       V P                  VP                  4       R4       \        RR7      pV P                  VP                  R4       V P                  VP                  4       R	4       \        R
R7      pV P                  VP                  R4       V P                  VP                  4       R4       \        RR7      pV P                  VP                  R4       V P                  VP                  4       R4       \         P                  ! R4      pV P                  VP                  R4       \         P                  ! R4      pV P                  VP                  R4       R# )httpsr   Tzhttps://zhttps:Fzhttps:/)r   r,  z	git+httpszgit+https://mailtozmailto:ztpNzztp:zztp://test.comzztp:test:com)r   r   r,  rV   rT   r}   s   & r%   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$//mm,-$/mmN+%0r(   c                    R p\         P                  ! V4      pVP                  R8X  g   Q hVP                  ^P8X  g   Q h\        VP
                  ,          VP                  8w  g   Q hR# )z5https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80/z'2001:0db8:85a3:0000:0000:8a2e:0370:7334N)r   rT   r   r*   r   r   )r    tre   s   &  r%   test_ipv6_with_portTestURL.test_ipv6_with_port$  sS    CmmAxxDDDDxx2~~szz*chh666r(   c                   R p\         P                  ! V4      pVP                  R8X  g   Q hVP                  R8X  g   Q hVP                  R8X  g   Q hVP
                  R
8X  g   Q hVP                  R8X  g   Q hRp\         P                  ! V4      pVP                  R8X  g   Q hVP                  R8X  g   Q hVP                  R8X  g   Q hVP
                  R
8X  g   Q hRp\         P                  ! V4      pVP                  R8X  g   Q hVP                  R8X  g   Q hVP                  R8X  g   Q hVP
                  R
8X  g   Q hR	# )z3https://user:pass@example.com/path/to/here?k=v#nicere  	user:passexample.com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::1N)r   tohere)r   rT   r   r+   r   r   r   r    textre   s   &  r%   
test_basicTestURL.test_basic,  s(   DmmD!zzW$$$||{***xx=(((xx1111||v%%%BmmD!zzW$$$||{***xx;&&&xx1111>mmD!zzW$$$||{***xx5   xx1111r(   c                P    V P                  \        \        P                  R 4       R# )z#

Nr   r   r   rT   rP   s   &r%   test_invalid_urlTestURL.test_invalid_urlD  s    -@r(   c                P    V P                  \        \        P                  R 4       R# )zhttp://abc:

/#Nrz  rP   s   &r%   test_invalid_authority_url"TestURL.test_invalid_authority_urlH  s    -8KLr(   c                    . ROpV Fl  pRV,           R,           pV P                  \        P                  \        \        P                  V4       V P                  \
        \        P                  V4       Kn  	  R# )2001::0234:C1ab::A0:aabc:003Fzhttp://[]N)r  z2001::1::3F:z::::z::256.0.0.1)r   socketerrorr   AF_INET6r   r   rT   )r    invalid_ipv6_ipsipr   s   &   r%   test_invalid_ipv6TestURL.test_invalid_ipv6L  sV    
 #B!B,HfllIvKmS]]HE #r(   c                    V P                  \        \        P                  R 4       V P                  \        \        P                  R4       R# )zftp://portmouth:smashz+http://reader.googlewebsite.com:neverforgetN)r   r   r   rT   r]  rP   s   &r%   test_invalid_portTestURL.test_invalid_portZ  s4    -8OPMM9	
r(   c                   \         P                  ! R 4      pV P                  VP                  R4       V P                  VP	                  4       R 4       V P                  VP                  4       P	                  4       R4       \         P                  ! R4      pV P                  VP                  R4       V P                  VP	                  4       R4       V P                  VP                  4       P	                  4       R4       R# )u   http://bücher.chu
   bücher.chzhttp://xn--bcher-kva.chhttps://xn--bcher-kva.chzxn--bcher-kva.chu   https://bücher.chN)r   rT   r   r   rV   r   rd   r   s   &  r%   	test_idnaTestURL.test_idnac  s    ]]./,/':;,,.0IJ]]56"45'AB,,.0DEr(   c                    \         P                  ! R 4      pV P                  VP                  R4       V P                  VP	                  4       R 4       \         P                  ! R4      pV P                  VP                  R4       V P                  VP	                  4       R4       \         P                  ! R4      pV P                  VP                  R4       V P                  VP	                  4       R4       \         P                  ! R4      pV P                  VP                  R4       V P                  VP	                  4       R4       \         P                  ! R4      pV P                  VP                  R	4       V P                  VP	                  4       R4       \         P                  ! R
4      pV P                  VP                  R4       V P                  VP	                  4       R
4       \        RRRR7      pV P                  VP	                  4       R4       \        R	RRRR7      pV P                  VP	                  4       R4       \         P                  ! R4      pVP                  RR7      pV P                  VP	                  4       R4       Rp\         P                  ! V4      pVP                  RR7      pV P                  VP	                  4       R4       VP                  RR7      pV P                  VP	                  4       V4       R# )zmailto:mahmoud@hatnote.comrg  zhttp://hatnote.comr3   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+mailtorh  T)r   r   r   z
ztp:/x/y/z)r   r   r   r,  zgit+ftp:///x/y/z/zfile:///path/to/heckrf  zmailto:/path/to/heckzunregisteredscheme:///a/b/cF)r,  zunregisteredscheme:/a/b/cN)xr   z)r  r   r  r   )r   rT   r   r   rV   r   )r    re   url2r   no_netloc_url
netloc_urls   &     r%   test_netloc_slashesTestURL.test_netloc_slasheso  s_    mm89X.(DEmm01V,(<= mm-.[1(9:mm12]3(=> mmCDY/(OPmmEF]3KKMD	
 _TB5 $	
 	(;< mm23{{({+)?@0mmH%6..02MN[[T[2
++-x8r(   c                    \        R.R7      pV P                  VP                  4       R4       VP                  RR7      pV P                  VP                  4       R4       V P	                  W4       R# )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   r7  T)r   z/helloN)r   r   rV   r   rm   )r    abs   &  r%   test_rooted_to_relativeTestURL.test_rooted_to_relative  sZ     gYg.IITI"h/A!r(   c                   \        RR.RR7      pV P                  VP                  R4       \        R.RR7      pV P                  VP                  R4       V P                  W4       \        RR.RR7      p\        RR.R7      pV P                  W44       V P                  VP                  R4       V P                  VP                  R4       R	# )
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   rJ   F)r   r   TrK   )r   r   r   )r   r   N)r   r   r   )r    relative_path_rootedrelative_flag_rootedattempt_unrooted_absolutenormal_absolutes   &    r%   test_autorootedTestURL.test_autorooted  s      #UEB-44d;"=-44d;-D$'U%$O!5w72D//62994@r(   c                   \        RRRR7      p\        RRR7      p\        RRRR7      pV P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       \         P                  ! R4      pV P                  \	        V4      \	        V4      4       V P                  \	        V4      \	        V4      4       V P                  VP                  4       VP                  4       4       V P                  W4       V P                  W4       V P                  W4       V P                  W$4       V P                  W44       R# )	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   r*   r   )r   r*   Tzudp://:4900N)r   r   r   rT   rO  asText)r    directly_constructeddirectly_constructed_implictdirectly_constructed_rootedparseds   &    r%   !test_rooted_with_port_but_no_host)TestURL.test_rooted_with_port_but_no_host  s!     #%d5I'*%d'C$&)T$&O#-44d;5<<dC4;;TB}-12CK@9:CKH-446H-6-L-K5>4=r(   c                    V P                  \        4      ;_uu_ 4        \        \        4       R R R 4       V P                  \        4      ;_uu_ 4        \        R4       R R R 4       R #   + '       g   i     LC; i  + '       g   i     R # ; i)NHTTP_____more_like_imHoTTeP)r   r]  r   rU   rP   s   &r%   test_wrong_constructorTestURL.test_wrong_constructor  sX    z**	N + z**-. +* +* +**s   A)A<)A9	<B	c                N   \         P                  ! R 4      pVP                  R8X  g   Q hVP                  RR7      pVP	                  4       pVP                  RR7      R8X  g   Q hVP                  RR7      R8X  g   Q hVP                  4       P                  RR7      R	8X  g   Q hR
# )zhttp://user:pass@example.comrp  zus%20her:passr  Tr\   zhttp://us her:pass@example.comFzhttp://us her:@example.comz http://us%20her:pass@example.comN)r   rT   r+   r   rd   rV   r   r    re   rf   s   &  r%   test_encoded_userinfoTestURL.test_encoded_userinfo  s    mm:;||{***kk?k3jjlKKdK+/OO	
O{{{/3OOOOJJL  t 412	
2r(   c                   / p\         P                  ! R 4      p\        V4      \        V4      8X  g   Q h^W&   \         P                  ! R4      pVP                  RR4      p^W&   \	        V4      ^8X  g   Q h\        VP                  4       4      ^.8X  g   Q h\        \        4       4      \        \        4       4      8X  g   Q hR# )z.http://blog.hatnote.com/ask?utm_source=geocityzhttp://blog.hatnote.com/ask
utm_sourcegeocityN)r   rT   hashr   lenlistvalues)r    url_mapurl1r  s   &   r%   	test_hashTestURL.test_hash   s    }}MNDzT$Z'''}}:;xxi07|q   GNN$%!,,,CE{d35k)))r(   c                    \        4       p\        V4      p\        V4      ^8  g   Q hRV9  g   Q hRV9  g   Q hRV9  g   Q hRV9  g   Q hR# )   r   r  r  r  N)r   dirr  )r    re   r   s   &  r%   test_dirTestURL.test_dir  sZ    e#h3x"}}$$$s"""c!!!c!!!r(   c                    \         P                  ! R 4      pVP                  4       R 8X  g   Q hVP                  4       P                  4       R8X  g   Q hR# )u"   http://example.com/a%20té%C3%A9stz&http://example.com/a%20t%C3%A9%C3%A9stN)r   r   r  r  r}   s   & r%   test_twisted_compatTestURL.test_twisted_compat  sD    ll?@zz|CCCCyy{!!#'OOOOr(   c                    \         P                  ! R 4      pVP                  RR4      pVP                  RR4      pVP	                  4       R8X  g   Q hR# )zhttp://example.com/?a=b&cr  r   z!http://example.com/?a=b&x=x&c&x=yN)r   rT   r   r   rV   r}   s   & r%   test_set_orderingTestURL.test_set_ordering%  sH     mm78ggc3ggc3{{} CCCCr(   c                   \         P                  ! R4      p\         P                  ! VP                  4       4      pW8X  g   Q h\         P                  ! VP                  4       P                  4       4      pW8X  g   Q hW#8X  g   Q h\         P                  ! R4      pVP                  4       pVP                  4       R8X  g   Q h\         P                  ! VP                  4       4      P	                  4       pWV8X  g   Q hR# )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   rT   rV   rd   r   )r    r   r   r   u4u5u6s   &      r%   test_schemeless_pathTestURL.test_schemeless_path0  s     ]]@A]]2::<(xx]]299;..01xxxx ]]NOYY[zz|HHHH]]2::<(//1xxr(   c                r    \         P                  ! R4      pVP                  4       pVP                  4        R# )z4See issue #7, affecting only narrow builds (2.6-3.3)zhttps://xn--vi8hiv.wsN)r   rT   rd   rV   r  s   &  r%   test_emoji_domainTestURL.test_emoji_domainC  s'     mm34jjlr(   c                    V P                  \        \        RRR7       V P                  \        \        RR7       V P                  \        \        RR7       V P                  \        \        R	R7       R# )
zPer issue #6 and #8r3   za/c)r   r   r7  r   N)?)#)&r_   )r   r]  r   rP   s   &r%   test_delim_in_paramTestURL.test_delim_in_paramK  sZ     	*c&uE*c7*c7*c-Ar(   c                   \         P                  ! R 4      p\         P                  ! R4      pW8X  g   Q h\         P                  ! R4      p\         P                  ! R4      pW8X  g   Q h\         P                  ! R4      p\         P                  ! R 4      pW8X  g   Q h\         P                  ! R 4      p\         P                  ! R 4      pW8X  g   Q hR# )zhttp://example.com/zhttp://example.comN)r   rT   r   s   &  r%   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xr(   c                    \         P                  ! R 4      P                  R8X  g   Q hV P                  \        \         P                  R4       V P                  \        \         P                  \        4       4       R# )z#okoks   bytes://x.y.zN)r   rT   r   r   rW  r   rP   s   &r%   test_from_text_typeTestURL.test_from_text_typei  sN    }}U#,,444)S]]4DE)S]]FH=r(   c                   V P                  \        \        P                  R 4       V P                  \        \        P                  R4       V P                  \        \        P                  R4       V P                  \        \        P                  R4       V P                  \        \        P                  R4       V P                  \        \        P                  R4       V P                  \        \        P                  R4       R# )z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::80Nrz  rP   s   &r%   test_from_text_bad_authority$TestURL.test_from_text_bad_authorityo  s     	-G-G-8HI-8HI 	-8KL-8MN-8NOr(   c                z   \         P                  ! R 4      pVP                  R4      . 8X  g   Q hVP                  R4      R.8X  g   Q h\        VP                  4      ^8X  g   Q hVP                  4       pVP                  R8X  g   Q hVP                  R8X  g   Q hVP                  R8X  g   Q hVP                  R4      R.8X  g   Q hVP                  R8X  g   Q hVP                  4       R8X  g   Q hVP                  R	R	R	R	R	R
7      pW18X  g   Q h\         P                  ! R4      pVP                  4       pVP                  4       R8X  g   Q h\         P                  ! R4      pVP                  4       pVP                  4       R8X  g   Q h\        RR7      P                  R	R7      P                  4       R8X  g   Q h\        RR7      P                  4       P                  4       R8X  g   Q h\        RRR.R .RRR7      pVP                  RR7      R8X  g   Q hVP                  4       P                  RR7      R8X  g   Q hR# )!z0HTTP://Example.com/A%61/./../A%61?B%62=C%63#D%64BbzB%62zC%63r3   rq  CcDdzhttp://example.com/Aa?Bb=Cc#DdFrM   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#testr7  )percentsz/%te%stsz/%25te%25stsftpz%%%z%a%b%z%:%)r   r   r   r   r+   Tr\   zftp://%:%@/%%%/%a%b?%=%%#%z0ftp://%25:%25@/%25%25%25/%25a%25b?%25=%25%25#%25N)Aa)r   z%te%sts)r  z%%)
r   rT   r   r  r   	normalizer   r   r   rV   )	r    re   norm_urlnoop_norm_urlslashless_urlslashful_urldelimited_urlnorm_delimited_urlpercenty_urls	   &        r%   test_normalizeTestURL.test_normalize  sH   mmNOwwt}"""wwv6(***388}!!! ==?&(((}}---}}'''||D!dV+++  D(((!%EEEE u5 & 
 ### &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r(   c                   R p\         P                  ! V4      p\        V4      V8X  g   Q h\        V4      R8X  g   Q h\        '       dE   \        \        V4      \        4      '       g   Q h\        \        V4      \        4      '       g   Q hR# \        \        V4      \        4      '       g   Q h\        \        V4      \        4      '       g   Q hR# )u&   http://example.com/á/y%20a%20y/?b=%25s*   http://example.com/%C3%A1/y%20a%20y/?b=%25N)r   rT   r   r\  PY2r   rO  ru  s   &  r%   test_strTestURL.test_str  s     8mmD!s|t###SzJJJJ3c#h....gclG4444c#h0000eCj%0000r(   c                N   \         P                  ! R 4      pVP                  4       P                  R8X  g   Q hVP	                  4       P                  R8X  g   Q h\         P                  ! R4      pVP                  4       P                  R8X  g   Q hVP	                  4       P                  R8X  g   Q hVP	                  4       P                  4       P                  R8X  g   Q hRp\         P                  ! V4      P	                  4       P                  4       P                  R8X  g   Q hR# )	u   http://abé.com/u   abé.comzxn--ab-cja.comu(   http://ドメイン.テスト.co.jp#testu   ドメイン.テスト.co.jpzxn--eckwd4c7c.xn--zckzah.co.jpzhttp://Example.comrq  N)r   rT   rd   r   r   get_decoded_url)r    re   rv  s   &  r%   test_idna_cornersTestURL.test_idna_corners  s    mm./zz|  J...zz|  $4444mmFGzz|  $BBBBzz|  $DDDDzz|++-226TTTT#MM$&&(88:??=P	
Pr(   r?  N)r   )RrF  rG  rH  rI  __doc__r&   r/   r6   rC   rG   rQ   rY   ra   rj   rn   rr   rw   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)  r.  r4  r8  r_  rb  ri  rm  rw  r{  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   rJ  rK  rL  s   @r%   r   r      s    =$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
 1D720AMF

F9v
"A.>6/
*$
"PD&B,>P 7
r1 
 
r(   r   )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   )r   http://a/b/c/)z./r  )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://localhostrq   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=3r  z"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%3Aok)
__future__r   sysr  typingr   r   r   r   r   r	   commonr
   r   r   r   _urlr   r   version_infor  r   r   rU   r   r   r^   r   r?  r(   r%   <module>r     s   ( 
  = = % ! - 
qQ
r( 9	 2 1 1 	1
 1 1 1 !1  1 #1  1 $1 1  1 (1  !1" #1$ %1& '1( )1* +1, -1. /10 116 !718 $91> ?1@ A1B C1D E1F  G1H  I1L M1N !O1P "Q1R !S1T *U1V %W1Z ([1\ *]1^ (_1` *a1 hAHF
 F
r(   