
    6\h^;                       d dl Z d dlZd dlZd dlZdZdZdZdZg dg fdg fdg fdd	gfd
dgfddgfddgfddgfddgfdddgfddgfddgfdddgfdddgfdg fd g fd!g fd"d#gfd$d%gfd&d'gfd(d'gfd)d*gfd+d,gfd-d.d/gfd0d1gfd2d.gfd3d4d5gfd6d7d8gfd9d:gfd;d<gfd=d>gfd?d@gfdAdBgfdCdBgfdDdEgfdFdGgfdHdGgfdIdJgfdKdJgfZ	g di fdi fdi fdddgifd
ddgifdddgifdddgifdddLgifddMdNgifddOgdPgdQfdddRgifdddOgifddSgdTgdfdddUdVgifdi fd i fd!i fd"ddgifd$dd&gifd&d&dgifd(d&dgifd)d&dWgifd+dXdYgifd-dZgd[gd\fd0d&d]gifd2d&dZgifd3d^gd_gd.fd6d&d`dagifd9dbdOgifd;ddcgifd=dddZgifd?d&degifdfd&dggifdAdhdigifdCdhdigifdDdjdjgifdFdkdlgifdHdkdlgifdIdmdngifdKdmdngifZ
 G do dpej                  Z G dq drej                  Z G ds dtej                  Zeduk    r ej                     dS dS )v    Nhttp://a/b/c/d;p?q#fhttp://a/b/c/d;p?qhttp://a/b/c/d &z&&=)r   r   z=a)r   ar	   )r	   r   za=za=b=c)r	   b=cza%3Db=c)a=bcza=b&c=dr	   b)r   dz	a=b%26c=d)r	   b&c=dz&a=bza=a+b&b=b+cr	   a br   b cza=1&a=2r	   1r	   2       &s   &&   =)r   r   s   =a)r      ar   )r   r   s   a=s   a=b=c)r      b=cs   a%3Db=c)   a=b   cs   a=b&c=dr      b)r      ds	   a=b%26c=d)r      b&c=ds   &a=bs   a=a+b&b=b+cr      a br!      b cs   a=1&a=2r      1r      2;a=b);ar   a=a+b;b=b+c)r	   	a b;b=b c   ;a=b)   ;ar!      a=a+b;b=b+c)r   	   a b;b=b cu   Ł=é)   Ł   éz%C5%81=%C3%A9z%81=%A9)   �r6   s   Ł=é)   Ł   és   %C5%81=%C3%A9s   =)      s   %81=%A9r
   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/   r1   r3   s   a=a%E2%80%99bs   a’br4   r5   r6   r7   r8   r9   r:   c                   Z   e Zd Zd9dZd Zd Zd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d  Z!d! Z"d" Z#d# Z$d$ Z%d% Z&d& Z'd' Z(d( Z)d) Z*d* Z+d+ Z,d, Z-d- Z.d. Z/d/ Z0d0 Z1d1 Z2d2 Z3d3 Z4d4 Z5d5 Z6d6 Z7d7 Z8d8 Z9dS ):UrlParseTestCaseNc                 	   ||}t           j                            |          }|                     ||           |j        |j        |j        |j        |j        |j	        f}|                     ||           t           j        
                    |          }|                     ||           |                     ||                                           t           j                            |                                          }|                     |                                |                                           |                     ||           |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     |j	        |j	                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   t           j                            |          }|                     ||           |j        |j        |j        |j        |j	        f}|                     ||           t           j                            |          }|                     ||           |                     ||                                           t           j                            |                                          }|                     |                                |                                           |                     ||           |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     |j	        |j	                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   |                     |j        |j                   d S N)urllibparseurlparseassertEqualschemenetlocpathparamsqueryfragment
urlunparsegeturlusernamepasswordhostnameporturlsplit
urlunsplit)	selfurlparsedspliturl2resulttresult2result3s	            </opt/python-3.11.14/usr/lib/python3.11/test/test_urlparse.pycheckRoundtripsz UrlParseTestCase.checkRoundtripsj   s   <D&&s++(((]FM6;]FL&/;F###,))&11$'''&--//222 ,''88))6==??;;;62226=9996=9996;7776=9996<888)6?;;;)6?;;;)6?;;;)6?;;;6;777 &&s++''']FM6;\6?,E""",))&11$'''&--//222 ,''88))6==??;;;62226=9996=9996;7776<888)6?;;;)6?;;;)6?;;;)6?;;;6;77777r   c                 $   t           D ]\  }}t          j                            |d          }|                     ||d|z             d |D             }t          j                            |d          }|                     ||d|z             d S )NTkeep_blank_valuesError parsing %rc                 <    g | ]}t          |d                    |S )   len).0vs     rZ   
<listcomp>z-UrlParseTestCase.test_qsl.<locals>.<listcomp>   s'    $D$D$D1#ad))$DQ$D$D$Dr   F)parse_qsl_test_casesr?   r@   	parse_qslrB   )rQ   origexpectrV   expect_without_blankss        rZ   test_qslzUrlParseTestCase.test_qsl   s    0 	7 	7LD&\++DD+IIFVV-?$-FGGG$D$D$D$D$D!\++DE+JJFV%:.57 7 7 7	7 	7r   c                 *   t           D ]\  }t          j                            |d          }|                     |d|z             fdD             }t          j                            |d          }|                     ||d|z             d S )NTr]   r_   c                 X    i | ]&}t          |         d                    ||         'S )r   rb   )rd   re   rj   s     rZ   
<dictcomp>z,UrlParseTestCase.test_qs.<locals>.<dictcomp>   sJ     %K %K %K)*F1IaL8I8I%KQq	 %K %K %Kr   F)parse_qs_test_casesr?   r@   parse_qsrB   )rQ   ri   rV   rk   rj   s       @rZ   test_qszUrlParseTestCase.test_qs   s    / 	7 	7LD&\**44*HHFVV-?$-FGGG%K %K %K %K.4%K %K %K!\**45*IIFV%:.57 7 7 7	7 	7r   c                 x    g d}d fd|D             }||z   D ]\  }}}|                      |||           d S )N))path/to/file)r   r   rt   r   r   r   )r   r   rt   r   r   )/path/to/filer   r   ru   r   r   r   r   r   ru   r   r   )//path/to/file)r   rE   /to/filer   r   r   )r   rE   ry   r   r   )z////path/to/file)r   r   rx   r   r   r   )r   r   rx   r   r   )zscheme:path/to/file)rC   r   rt   r   r   r   )rC   r   rt   r   r   )scheme:/path/to/filerC   r   ru   r   r   r   rC   r   ru   r   r   )zscheme://path/to/file)rC   rE   ry   r   r   r   )rC   rE   ry   r   r   )zscheme:////path/to/file)rC   r   rx   r   r   r   )rC   r   rx   r   r   )file:///tmp/junk.txtfiler   /tmp/junk.txtr   r   r   r   r   r   r   r   )zfile:////tmp/junk.txt)r   r   //tmp/junk.txtr   r   r   )r   r   r   r   r   )zfile://///tmp/junk.txt)r   r   ///tmp/junk.txtr   r   r   )r   r   r   r   r   )zimap://mail.python.org/mbox1)imapmail.python.org/mbox1r   r   r   )r   r   r   r   r   )z1mms://wms.sys.hinet.net/cts/Drama/09006251100.asf)mmswms.sys.hinet.net/cts/Drama/09006251100.asfr   r   r   )r   r   r   r   r   )znfs://server/path/to/file.txt)nfsserver/path/to/file.txtr   r   r   )r   r   r   r   r   )z0svn+ssh://svn.zope.org/repos/main/ZConfig/trunk/)svn+sshsvn.zope.org/repos/main/ZConfig/trunk/r   r   r   )r   r   r   r   r   )z)git+ssh://git@github.com/user/project.git)git+sshgit@github.com/user/project.gitr   r   r   )r   r   r   r   r   c                     | d                              d          t          d | d         D                       t          d | d         D                       fS )Nr   asciic              3   @   K   | ]}|                     d           V  dS r   Nencoderd   xs     rZ   	<genexpr>zDUrlParseTestCase.test_roundtrips.<locals>._encode.<locals>.<genexpr>   .      ::!((7++::::::r   ra   c              3   @   K   | ]}|                     d           V  dS r   r   r   s     rZ   r   zDUrlParseTestCase.test_roundtrips.<locals>._encode.<locals>.<genexpr>   r   r      r   tuplerW   s    rZ   _encodez1UrlParseTestCase.test_roundtrips.<locals>._encode   [    aDKK((::QqT:::::::QqT:::::< <r   c                 &    g | ]} |          S  r   rd   r   r   s     rZ   rf   z4UrlParseTestCase.test_roundtrips.<locals>.<listcomp>   !    555awwqzz555r   r[   )rQ   	str_casesbytes_casesrR   rS   rT   r   s         @rZ   test_roundtripsz UrlParseTestCase.test_roundtrips   s    7 7 7	p	< 	< 	< 65559555"+k"9 	5 	5C  fe4444	5 	5r   c                 |    g d}d fd|D             }||z   D ]\  }}}}|                      ||||            d S )N))z///path/to/fileru   rv   rw   )zscheme:///path/to/filerz   r{   r|   )zfile:/tmp/junk.txtr}   r~   r   )zhttp:/tmp/junk.txtzhttp:///tmp/junk.txt)httpr   r   r   r   r   )r   r   r   r   r   )zhttps:/tmp/junk.txtzhttps:///tmp/junk.txt)httpsr   r   r   r   r   )r   r   r   r   r   c                     | d                              d          | d                              d          t          d | d         D                       t          d | d         D                       fS )Nr   r   ra   c              3   @   K   | ]}|                     d           V  dS r   r   r   s     rZ   r   zRUrlParseTestCase.test_roundtrips_normalization.<locals>._encode.<locals>.<genexpr>  r   r   r   c              3   @   K   | ]}|                     d           V  dS r   r   r   s     rZ   r   zRUrlParseTestCase.test_roundtrips_normalization.<locals>._encode.<locals>.<genexpr>  r   r      r   r   s    rZ   r   z?UrlParseTestCase.test_roundtrips_normalization.<locals>._encode
  sn    aDKK((aDKK((::QqT:::::::QqT:::::< <r   c                 &    g | ]} |          S r   r   r   s     rZ   rf   zBUrlParseTestCase.test_roundtrips_normalization.<locals>.<listcomp>  r   r   r   )rQ   r   r   rR   rU   rS   rT   r   s          @rZ   test_roundtrips_normalizationz.UrlParseTestCase.test_roundtrips_normalization   s    
 
 
	,	< 	< 	<
 65559555(1K(? 	; 	;$Cvu  feT::::	; 	;r   c                     g d}d fd|D             }d}d}||f}||f}||fD ];\  }}|D ]3}	|D ].\  }
}}|	|
z   }
|	f|z   }|	f|z   }|                      |
||           /4<d S )N))z://www.python.org)www.python.orgr   r   r   r   )r   r   r   r   )z://www.python.org#abc)r   r   r   r   abc)r   r   r   r   )z://www.python.org?q=abc)r   r   r   q=abcr   )r   r   r   r   )z://www.python.org/#abc)r   /r   r   r   )r   r   r   r   )z://a/b/c/d;p?q#f)r	   z/b/c/dpqf)r	   z/b/c/d;pr   r   c                     | d                              d          t          d | d         D                       t          d | d         D                       fS )Nr   r   c              3   @   K   | ]}|                     d           V  dS r   r   r   s     rZ   r   zIUrlParseTestCase.test_http_roundtrips.<locals>._encode.<locals>.<genexpr>*  r   r   ra   c              3   @   K   | ]}|                     d           V  dS r   r   r   s     rZ   r   zIUrlParseTestCase.test_http_roundtrips.<locals>._encode.<locals>.<genexpr>+  r   r   r   r   r   s    rZ   r   z6UrlParseTestCase.test_http_roundtrips.<locals>._encode(  r   r   c                 &    g | ]} |          S r   r   r   s     rZ   rf   z9UrlParseTestCase.test_http_roundtrips.<locals>.<listcomp>,  r   r   )r   r   )   http   httpsr   )rQ   r   r   str_schemesbytes_schemes	str_testsbytes_testsschemes
test_casesrC   rR   rS   rT   r   s                @rZ   test_http_roundtripsz%UrlParseTestCase.test_http_roundtrips  s      	"	< 	< 	< 65559555'+*	#[0$-{#; 	= 	=GZ! = =*4 = =&C 3,C$Y/F#I-E((fe<<<<	==	= 	=r   c                    |||f}|                      t          j                            ||          |           d |D             x}\  }}}|                      t          j                            ||          |           d S )Nc                 8    g | ]}|                     d           S r   r   r   s     rZ   rf   z.UrlParseTestCase.checkJoin.<locals>.<listcomp><  s7     8G 8G 8G23AHHW--8G 8G 8Gr   )rB   r?   r@   urljoin)	rQ   baserelurlexpectedstr_componentsbytes_componentsbasebrelurlb	expectedbs	            rZ   	checkJoinzUrlParseTestCase.checkJoin9  s    1--dF;;XFFF8G 8G7E8G 8G 8G 	G45'9--eW==yIIIIIr   c                 v   g d}d |D             }||z   D ]}|                      t          j                            t          j                            |                    |           |                      t          j                            t          j                            |                    |           d S )N)Pythonz./Pythonx-newscheme://foo.com/stuffzx://yzx:/yzx:/r   c                 8    g | ]}|                     d           S r   r   r   s     rZ   rf   z7UrlParseTestCase.test_unparse_parse.<locals>.<listcomp>B  $    <<<Qqxx((<<<r   )rB   r?   r@   rP   rO   rI   rA   )rQ   r   r   us       rZ   test_unparse_parsez#UrlParseTestCase.test_unparse_parse@  s    bbb	<<)<<<[( 	S 	SAV\44V\5J5J15M5MNNPQRRRV\44V\5J5J15M5MNNPQRRRR	S 	Sr   c                    |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          d	d
           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          d d           |                      t          d!d"           |                      t          d#d$           |                      t          d%d$           |                      t          d&d           |                      t          d'd(           |                      t          d)d*           |                      t          d+d,           |                      t          d-d.           |                      t          d/d0           |                      t          d1d"           |                      t          d2d           |                      t          d3d4           |                      t          d5d6           d S )7Ng:hghttp://a/b/c/g./gg/http://a/b/c/g//g
http://a/g//ghttp://gg?yhttp://a/b/c/g?yg?y/./xhttp://a/b/c/g?y/./x#shttp://a/b/c/d;p?q#sg#shttp://a/b/c/g#sg#s/./xhttp://a/b/c/g#s/./xg?y#shttp://a/b/c/g?y#sg;xhttp://a/b/c/g;xg;x?y#shttp://a/b/c/g;x?y#s.http://a/b/c/./..http://a/b/../../ghttp://a/b/g../..	http://a/../../../../gr   r   g.http://a/b/c/g..ghttp://a/b/c/.gg..http://a/b/c/g....ghttp://a/b/c/..g./../g./g/.g/./hhttp://a/b/c/g/hg/../hhttp://a/b/c/h)r   RFC1808_BASErQ   s    rZ   test_RFC1808zUrlParseTestCase.test_RFC1808G  s   |UE222|S*:;;;|U,<===|T+<===|T<888|UJ777|U,>???|Y0FGGG|T+ABBB|U,>???|Y0FGGG|W.BCCC|U,>???|Y0FGGG|S/:::|T?;;;|T=999|UM:::|V^<<<|Wk:::|X{;;;|Y=== 	|R)?@@@|T+<===|T+<===|U,>???|U,>???|X~>>>|W.?@@@|W.@AAA|X/?@@@@@r   c                 l    |                      t          j                            d          d           d S )Nzmailto:1337@example.org)mailtor   z1337@example.orgr   r   r   rB   r?   r@   rA   r  s    rZ   test_RFC2368zUrlParseTestCase.test_RFC2368w  s?    ../HII>	@ 	@ 	@ 	@ 	@r   c                    |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          d	d
           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd            |                      t          d!d            |                      t          d"d           |                      t          d#t                     |                      t          d$d%           |                      t          d&d'           |                      t          d(d)           |                      t          d*d+           |                      t          d,d           |                      t          d-d           |                      t          d.d/           |                      t          d0d1           |                      t          d2d3           |                      t          d4d5           |                      t          d6d7           |                      t          d8d9           |                      t          d:d;           |                      t          d<d=           d S )>Nr   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  r  r   r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  	g;x=1/./yhttp://a/b/c/g;x=1/y
g;x=1/../yhttp://a/b/c/yr   r   g?y/../xhttp://a/b/c/g?y/../xr   r   g#s/../xhttp://a/b/c/g#s/../x)r   RFC2396_BASEr  s    rZ   test_RFC2396zUrlParseTestCase.test_RFC2396|  s"    	|UE222|S*:;;;|U,<===|T+<===|T<888|UJ777|U,>???|T+ABBB|U,>???|W.BCCC|U,>???|Y0FGGG|S/:::|T?;;;|T=999|UM:::|V^<<<|Wk:::|X{;;;|Y===|R666|T+<===|T+<===|U,>???|U,>???|X~>>>|W.?@@@|W.@AAA|X/?@@@|[2HIII|\3CDDD|Y0FGGG|Z1HIII|Y0FGGG|Z1HIIIIIr   c                 
   |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          d	d
           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          d d!           |                      t          d"d!           |                      t          d#d$           |                      t          d%d&           |                      t          d'd&           |                      t          d(d           |                      t          d)d           |                      t          d)d           |                      t          d*d           |                      t          d+d           |                      t          d,d           |                      t          d-d.           |                      t          d/d0           |                      t          d1d2           |                      t          d3d4           |                      t          d5d$           |                      t          d6d
           |                      t          d7d8           |                      t          d9d:           |                      t          d;d<           |                      t          d=d>           |                      t          d?d@           |                      t          dAdB           |                      t          dCdD           |                      t          dEdF           |                      t          dGd           |                      dHdd           d S )IN?yzhttp://a/b/c/d;p?yz;xzhttp://a/b/c/;xr   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  r  r  r  z
../../../gz../../../../gz/./gz/../gr  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"  http:gzhttp://a/b/c/de)r   RFC3986_BASEr  s    rZ   test_RFC3986zUrlParseTestCase.test_RFC3986  s   |T*>???|T+<===|U5111|S)9:::|U+;<<<|T*;<<<|T,777|U:666|T*>???|U+=>>>|T*@AAA|U+=>>>|W-ABBB|T*;<<<|U+=>>>|Y/EFFF|R(<===|S999|T/:::|T-888|U=999|VN;;;|W[999|Xk:::|Y|<<<|\<@@@ 	|\,???|_\BBB|VL999|W\:::|T*;<<<|T*;<<<|U+=>>>|U+=>>>|Xn===|W->???|W-?@@@|X.>???|[1GHHH|\2BCCC|Y/EFFF|Z0GHHH|Y/EFFF|Z0GHHH|X.>??? 	($/@AAAAAr   c                    |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd	           |                      t          d
d           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          dd           |                      t          d d	           |                      t          d!d"           |                      t          d#d$           |                      t          dd           |                      t          dd           |                      t          d%d           |                      t          d&d           |                      t          d'd           |                      d(dd(           |                      d)dd           |                      d)d*d*           |                      d+d,d-           |                      d.d,d/           |                      d0dd1           |                      d2dd3           |                      t          d4z   d5t          d6z              |                      d7d8d9           |                      d:d8d;           |                      d7d<d=           |                      d:d<d=           |                      d7d>d?           |                      dd8d=           |                      d@dAdA           d S )BNr   r'  r   http:r   r   r   r   r   r   r   r   r   r&  zhttp://a/b/c/d?yr   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r  zhttp:?yzhttp:g?yzhttp:g?y/./xzhttp:///r   zhttp://a/./gzsvn://pathtorepo/dir1dir2zsvn://pathtorepo/dir2zsvn+ssh://pathtorepo/dir1zsvn+ssh://pathtorepo/dir2zws://a/bzws://a/gz	wss://a/bz	wss://a/gr   fooz/foozhttp://a/b/c/d/e/z
../../f/g/zhttp://a/b/c/f/g/zhttp://a/b/c/d/ezhttp://a/b/f/g/z/../../f/g/zhttp://a/f/g/z	../../f/gzhttp://a/b/c/f/gr	   r   )r   SIMPLE_BASEr  s    rZ   test_urljoinszUrlParseTestCase.test_urljoins  s   {E%000{H-=>>>{G,<==={C(8999{E*:;;;{D):;;;{D666{E*555{D);<<<{E*<==={I.DEEE{C888{D999{D777{E-888{F>:::{GK888{Il;;;{H^<<<{G,=>>>{G,>???{H-=>>>{H-=>>>{G,<==={I.@AAA{J/ABBB{N3IJJJz4
333r12HIIIr>>:::.8OPPP2F<WXXXz#j111{3{333 	{S(%v1EFFF 	*L:MNNN)<9JKKK*M?KKK)=/JJJ*K9KLLL}lODDD 	sC%%%%%r   c                 V   g d}d fd|D             }||z   D ]I\  }}}t           j                            |          }|                     |j        |j        f||f           Jg d}d |D             }||z   D ]-}|                     t          t           j        j        |           .d S )N))z http://Test.python.org:5432/foo/test.python.org8  )zhttp://12.34.56.78:5432/foo/12.34.56.78r2  )zhttp://[::1]:5432/foo/::1r2  )zhttp://[dead:beef::1]:5432/foo/dead:beef::1r2  )zhttp://[dead:beef::]:5432/foo/dead:beef::r2  )z:http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]:5432/foo/'dead:beef:cafe:5417:affe:8fa3:deaf:feedr2  )z http://[::12.34.56.78]:5432/foo/::12.34.56.78r2  )z%http://[::ffff:12.34.56.78]:5432/foo/::ffff:12.34.56.78r2  )zhttp://Test.python.org/foo/r1  N)zhttp://12.34.56.78/foo/r3  N)zhttp://[::1]/foo/r4  N)zhttp://[dead:beef::1]/foo/r5  N)zhttp://[dead:beef::]/foo/r6  N)z5http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/r7  N)zhttp://[::12.34.56.78]/foo/r8  N)z http://[::ffff:12.34.56.78]/foo/r9  N)zhttp://Test.python.org:/foo/r1  N)zhttp://12.34.56.78:/foo/r3  N)zhttp://[::1]:/foo/r4  N)zhttp://[dead:beef::1]:/foo/r5  N)zhttp://[dead:beef::]:/foo/r6  N)z6http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]:/foo/r7  N)zhttp://[::12.34.56.78]:/foo/r8  N)z!http://[::ffff:12.34.56.78]:/foo/r9  Nc                 |    | d                              d          | d                              d          | d         fS )Nr   r   ra   r   r   r   s    rZ   r   z.UrlParseTestCase.test_RFC2732.<locals>._encode:  s3    Q4;;w''1W)=)=qtCCr   c                 &    g | ]} |          S r   r   r   s     rZ   rf   z1UrlParseTestCase.test_RFC2732.<locals>.<listcomp><  r   r   )zhttp://::12.34.56.78]/zhttp://[::1/foo/zftp://[::1/foo/bad]/badzhttp://[::1/foo/bad]/badzhttp://[::ffff:12.34.56.78c                 8    g | ]}|                     d           S r   r   r   s     rZ   rf   z1UrlParseTestCase.test_RFC2732.<locals>.<listcomp>G  r   r   )r?   r@   rA   rB   rM   rN   assertRaises
ValueError)	rQ   r   r   rR   rM   rN   	urlparsedinvalid_urlr   s	           @rZ   test_RFC2732zUrlParseTestCase.test_RFC2732  s     	@	D 	D 	D55559555#,{#: 	V 	VC4--c22Ii0).AXtDTUUUU. . .	 =<)<<<${2 	N 	NKj&,*?MMMM	N 	Nr   c                    ddddddddt           d	d
ft          d	dfg
}d fd|D             }||z   D ]\  }}}t          j                            |          }|                     |                                |           |                     |||f           |                     |j        |           |                     |j        |           d S )N)zhttp://python.org#fraghttp://python.orgfrag)rC  rC  r   )zhttp://python.org/#fraghttp://python.org/rD  )rE  rE  r   )zhttp://python.org/?q#fraghttp://python.org/?qrD  )rF  rF  r   )zhttp://python.org/p#fragzhttp://python.org/prD  )http://python.org/p?qrG  r   r   r   r   c                 F     t          |           d | D                       S )Nc              3   @   K   | ]}|                     d           V  dS r   r   r   s     rZ   r   zCUrlParseTestCase.test_urldefrag.<locals>._encode.<locals>.<genexpr>Y  s.      88188G,,888888r   )typer   s    rZ   r   z0UrlParseTestCase.test_urldefrag.<locals>._encodeX  s'    47788a888888r   c                 &    g | ]} |          S r   r   r   s     rZ   rf   z3UrlParseTestCase.test_urldefrag.<locals>.<listcomp>Z  r   r   )	r  r#  r?   r@   	urldefragrB   rJ   rR   rH   )rQ   r   r   rR   defragrD  rV   r   s          @rZ   test_urldefragzUrlParseTestCase.test_urldefragK  s   C:E<I@GB/5/4
		9 	9 	955559555!*[!8 	4 	4C\++C00FV]]__c222Vfd^444VZ000V_d3333	4 	4r   c                 Z   t           j                            d          }|                     |j        d           |                     |j        d           t           j                            d          }|                     |j        d           |                     |j        d           d S )Nz,http://[FE80::822a:a8ff:fe49:470c%tESt]:1234zfe80::822a:a8ff:fe49:470c%tEStz%[FE80::822a:a8ff:fe49:470c%tESt]:1234s,   http://[FE80::822a:a8ff:fe49:470c%tESt]:1234s   fe80::822a:a8ff:fe49:470c%tESts%   [FE80::822a:a8ff:fe49:470c%tESt]:1234)r?   r@   rO   rB   rM   rD   )rQ   r   s     rZ   test_urlsplit_scoped_IPv6z*UrlParseTestCase.test_urlsplit_scoped_IPv6b  s    L!!"PQQ%EFFF#JKKKL!!"QRR%FGGG#KLLLLLr   c                    d}t           j                            |          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d            |                     |j
        d            |                     |j        d           |                     |j        d            |                     |                                dd          |dd                     d	}t           j                            |          }|                     |j        d           |                     |j        d
           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d           |                     |j
        d           |                     |j        d           |                     |j        d           |                     |                                |           d}t           j                            |          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d           |                     |j
        d           |                     |j        d           |                     |j        d           |                     |                                |           d}t           j                            |          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d            |                     |j
        d            |                     |j        d           |                     |j        d            |                     |                                dd          |dd                     d}t           j                            |          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d           |                     |j
        d           |                     |j        d           |                     |j        d           |                     |                                |           d}t           j                            |          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d            |                     |j
        d           |                     |j        d           |                     |j        d           |                     |                                |           d!}t           j                            |          }|                     t          d"          5  |j         d d d            d S # 1 swxY w Y   d S )#NzHTTP://WWW.PYTHON.ORG/doc/#fragr   zWWW.PYTHON.ORG/doc/r   rD  r      7http://User:Pass@www.python.org:080/doc/?query=yes#fragUser:Pass@www.python.org:080	query=yesUserPassP   zChttp://User@example.com:Pass@www.python.org:080/doc/?query=yes#frag(User@example.com:Pass@www.python.org:080zUser@example.coms   HTTP://WWW.PYTHON.ORG/doc/#fragr   s   WWW.PYTHON.ORG   /doc/r      frag   www.python.orgs7   http://User:Pass@www.python.org:080/doc/?query=yes#frag   User:Pass@www.python.org:080	   query=yes   User   PasssC   http://User@example.com:Pass@www.python.org:080/doc/?query=yes#frags(   User@example.com:Pass@www.python.org:080s   User@example.coms%   HTTP://WWW.PYTHON.ORG:65536/doc/#fragzout of range)r?   r@   rO   rB   rC   rD   rE   rG   rH   rK   rL   rM   rN   rJ   assertRaisesRegexr>  )rQ   rR   r   s      rZ   test_urlsplit_attributesz)UrlParseTestCase.test_urlsplit_attributesk  s4   /L!!#&&6***#3444)))"%%%V,,,T***T***%5666&&& 	ABBQRR111GL!!#&&6***#ABBB)))+...V,,,V,,,V,,,%5666$$$S))) TL!!#&&6***#MNNN)))+...V,,,%7888V,,,%5666$$$S))) 1L!!#&&7+++#4555***#&&&W---T***T***%6777&&&ABBQRR111HL!!#&&7+++#BCCC***,///W---W---W---%6777$$$S)))TL!!#&&7+++#NOOO***,///W---%8999W---%6777$$$S))) 7L!!#&&##J?? 	 	FF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   __!_c                    d}t           j                            |          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d            |                     |j
        d            |                     |j        d           |                     |j        d            |                     |                                d           d}t           j                            |          }|                     |j        d	           |                     |j        d
           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j	        d            |                     |j
        d            |                     |j        d
           |                     |j        d            |                     |                                d           d}d}t          d          D ]f}t           j                            ||          }|                     |j        d           |                     |                                d           gd S )NzQhttp	://www.python
.org	/java
script:	alert('msg
')/?query
=	something#frag
mentr   r   z/javascript:alert('msg')/zquery=somethingrH   zGhttp://www.python.org/javascript:alert('msg')/?query=something#fragmentsQ   http	://www.python
.org	/java
script:	alert('msg
')/?query
=	something#frag
mentr   r]  s   /javascript:alert('msg')/s   query=something   fragmentsG   http://www.python.org/javascript:alert('msg')/?query=something#fragmentzNhttp://www.python.org/java
script:	alert('msg
')/?query
=	something#frag
mentzht
tpr   rC   )r?   r@   rO   rB   rC   rD   rE   rG   rH   rK   rL   rM   rN   rJ   range)rQ   rR   r   rC   _s        rZ   !test_urlsplit_remove_unsafe_bytesz2UrlParseTestCase.test_urlsplit_remove_unsafe_bytes  s   kL!!#&&6***#3444!<==="3444Z000T***T***%5666&&&%nooo mL!!#&&7+++#4555!=>>>"4555[111T***T***%6777&&&%oppp fq 	t 	tA%%c&%99AQXv...QXXZZ)rssss	t 	tr   c                 n	   t          t          dd                    }d}|                    d          |z   }t          j                            |          }|                     |j        d           |                     |j        d           |                     |j	        d           |                     |j
        d           |                     |j        d	           |                     |j        d
           |                     |j        d           |                     |j        d           |                     |j        d           |                     |                                |           ||                    d          z   }t          j                            |          }|                     |j        d           |                     |j        d           |                     |j	        d           |                     |j
        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           |                     |                                |                    d                     d}t          j                            |                    d          |z             }|                     |j        d           |                     |j        d           |                     |j	        d           |                     |j
        d           |                     |j        d           |                     |                                |           t          j                            d          }|                     t          j                            |          d           d}|                    d          dz   |                    d          z   }t          d          D ]f}t          j                            ||          }|                     |j        d           |                     |                                d           gd S ) Nr   !   rT  utf-8r   rU  rR  rV  rD  rW  rX  r   rY  r   r^  r[  r_  r\  r`  ra  r]  z)https://www.python.org:88/doc/?query=    r   zwww.python.org:88z
query=    X   zwww.pypi.org z//www.python.org/r   rf  zhttps://www.python.org/)bytesrg  decoder?   r@   rO   rB   rC   rD   rE   rG   rH   rK   rL   rM   rN   rJ   r   rP   )rQ   noisebase_urlrR   r   query_spaces_urlrC   rh  s           rZ   test_urlsplit_strip_urlz(UrlParseTestCase.test_urlsplit_strip_url  s   eAx(())Lll7##h.L!!#&&6***#ABBB)))+...V,,,V,,,V,,,%5666$$$X...hoog...L!!#&&7+++#BCCC***,///W---W---W---%6777$$$X__W%=%=>>> GL!!%,,w"7"7:J"JKK7+++#6777))),///$$$%5666L!!/22 	0033_EEE "g&&05<<3H3HHq 	D 	DA%%c&%99AQXw///QXXZZ)BCCCC	D 	Dr   c           
      n   	 dD ]/}t           j        j        t           j        j        fD ]}dD ]}|                     |||          5  d|z   }d|z   dz   }|r`|                                r?|                                r+|                    d          }|                    d          }n	 d d d             ||          }|                     |j        |           | 	                    t                    5  |j         d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   
1d S )NFT)	r-  z1.5z-10x10z-01_1z 1z1 u   ६)rn  r@   rN   zwww.example.net:zhttp://r   r   )r?   r@   rO   rA   subTestisasciir   rB   rD   r=  r>  rN   )rQ   rn  r@   rN   rD   rR   r   s          rZ   test_attributes_bad_portz)UrlParseTestCase.test_attributes_bad_port(  s   ." 	# 	#E ,/1FG # #X # #DETJJ # #!3d!:'&036  )%~~// )DLLNN ))/w)?)?&)jj&9&9 (# # # # # # # "E#JJ((6:::!..z:: # #FF# # # # # # # # # # # # # # ## # # # # # # # # # # # # # ###	# 	#s>   	A$D$	9A D$	9DD$	DD$	DD$	$D(+D(c           	         	 dD ]}t           j        j        t           j        j        fD ]}dD ]}|                     |||          5  |dz   }|r7|                                r|                    d          }n	 d d d            Y ||          }|r|                     |j        d           n|                     |j        d           d d d            n# 1 swxY w Y   d S )Nru  )r   +-0zhttp&u   ६http)rn  r@   rC   z://www.example.netr   r   r   )	r?   r@   rO   rA   rx  ry  r   rB   rC   )rQ   rn  r@   rC   rR   r   s         rZ   test_attributes_bad_schemez+UrlParseTestCase.test_attributes_bad_scheme;  si   0" 	; 	;E ,/1FG ; ;F ; ;FEvNN ; ;$';;  )"{{}} )&)jj&9&9 (; ; ; ; ; ; ; "E#JJ  ; ,,QXs;;;; ,,QXr:::; ; ; ; ; ; ; ; ; ; ; ; ; ; ;;;	; 	;s   3C	AC	CCc                 ~   d}t           j                            |          }|                     |j        d           |                     |j        d            |                     |j        d            |                     |j        d            |                     |j        d            |                     |	                                |           t           j        
                    |          }|                     |j        d           |                     |j        d            |                     |j        d            |                     |j        d            |                     |j        d            |                     |	                                |           d}t           j                            |          }|                     |j        d           |                     |j        d            |                     |j        d            |                     |j        d            |                     |j        d            |                     |	                                |           t           j        
                    |          }|                     |j        d           |                     |j        d            |                     |j        d            |                     |j        d            |                     |j        d            |                     |	                                |           d S )Nz0sip:alice@atlanta.com;maddr=239.255.255.1;ttl=15r   s0   sip:alice@atlanta.com;maddr=239.255.255.1;ttl=15r   )r?   r@   rO   rB   rD   rK   rL   rM   rN   rJ   rA   )rQ   urir   s      rZ   test_attributes_without_netlocz/UrlParseTestCase.test_attributes_without_netlocM  s    AL!!#&&2&&&T***T***T***&&&S)))L!!#&&2&&&T***T***T***&&&S))) BL!!#&&3'''T***T***T***&&&S)))L!!#&&3'''T***T***T***&&&S)))))r   c                     |                      t          j                            d          d           |                      t          j                            d          d           d S )Nz http://example.com?blahblah=/foo)r   zexample.comr   r   zblahblah=/foor   s    http://example.com?blahblah=/foo)r   s   example.comr   r   s   blahblah=/foor   r  r  s    rZ   test_noslashzUrlParseTestCase.test_noslashv  sp    ../QRRM	O 	O 	O../RSSS	U 	U 	U 	U 	Ur   c                 j   |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d	          d
           |                      t          j                            d          d           d S )NrE   )r   r   rE   r   r   r   z//www.python.org:80)r   www.python.org:80r   r   r   r   http://www.python.org:80r   r  r   r   r   r      path)r   r   r  r   r   r   s   //www.python.org:80)r      www.python.org:80r   r   r   r      http://www.python.org:80r   r  r   r   r   r   r  r  s    rZ   test_withoutschemez#UrlParseTestCase.test_withoutscheme}  s'   
 	..v66'	) 	) 	)../DEE4	6 	6 	6../IJJ8	: 	: 	: 	..w77-	/ 	/ 	/../EFF:	< 	< 	<../JKK>	@ 	@ 	@ 	@ 	@r   c                    |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d	          d
           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           d S )Nzhttp:80)r   r   80r   r   r   zhttps:80)r   r   r  r   r   r   zpath:80)rE   r   r  r   r   r   r+  )r   r   r   r   r   r   zhttps:)r   r   r   r   r   r   r  r  s   http:80)r   r      80r   r   r   s   https:80)r   r   r  r   r   r   s   path:80)r  r   r  r   r   r   s   http:)r   r   r   r   r   r   s   https:)r   r   r   r   r   r   r  r  r  r  s    rZ   test_portseparatorz#UrlParseTestCase.test_portseparator  s   ..y99;TUUU..z::<VWWW..y99;TUUU..w778OPPP..x889QRRR../IJJ8	: 	: 	: 	..z::<[\\\..{;;=]^^^..z::<[\\\..x889VWWW..y99:XYYY../JKK>	@ 	@ 	@ 	@ 	@r   c                 \    |                      t          t          j        j        d           d S )Nr-  )r=  	TypeErrorr?   r@   	urlencoder  s    rZ   test_usingsyszUrlParseTestCase.test_usingsys  s%    )V\%;UCCCCCr   c                 6   |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d	          d
           |                      t          j                            d          d           |                      t          j                            d          d           |                      t          j                            d          d           d S )Nzs3://foo.com/stuff)s3foo.com/stuffr   r   r   r   )x-newschemer  r  r   r   r   z*x-newscheme://foo.com/stuff?query#fragment)r  r  r  r   rG   rH   z!x-newscheme://foo.com/stuff?query)r  r  r  r   rG   r   s   s3://foo.com/stuff)s   s3   foo.com   /stuffr   r   r   s   x-newscheme://foo.com/stuff)   x-newschemer  r  r   r   r   s*   x-newscheme://foo.com/stuff?query#fragment)r  r  r  r      queryre  s!   x-newscheme://foo.com/stuff?query)r  r  r  r   r  r   r  r  s    rZ   test_anyschemezUrlParseTestCase.test_anyscheme  s   ../CDD@	B 	B 	B../LMMI	K 	K 	K../[\\V	X 	X 	X../RSSN	P 	P 	P 	../DEEF	H 	H 	H../MNNO	Q 	Q 	Q../\]]\	^ 	^ 	^../STTT	V 	V 	V 	V 	Vr   c                    t           j        j        t           j        j        fD ]]}|                     |          5   |dd          }|                     |j        d            |dd          }|                     |j        d           |                      |dd          j        d           |                      |dd	          j        d           |                      |d
d	          j        d           |                      |d          j        d           |                      |d
          j        d           |                      |d
d          j        d           d d d            n# 1 swxY w Y   _d S )N)functionzhttp://example.net/ftpr   s   http://example.net/s   ftpr   rE   rf  r  r   r   )r?   r@   rA   rO   rx  rB   rC   )rQ   funcrV   s      rZ   test_default_schemez$UrlParseTestCase.test_default_scheme  s   \*FL,AB 	@ 	@Dt,, 
@ 
@3U;;  7774f==  888  fe!4!4!;UCCC  fU!;!;!;!BEJJJ  gf!=!=!=!DfMMM  f!4b999  g!5s;;;  gr!2!2!93???
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@ 
@	@ 	@s   D-E55E9	<E9	c           
      `   d}|D ]\  }}}t           j        j        t           j        j        fD ]|}|dk    r|t           j        j        u rd}|                     ||          5   ||d          }|                     |j        d           |                     t          ||          	                    d|z                        |                      ||dd          j        d            ||d	          }|                     |j        |           | 
                    t          ||          	                    |                     |                      ||dd	          j        |           |                      ||          j        |           d d d            n# 1 swxY w Y   ~d S )
N)
)z
http:#fragrE   rD  )z//example.net#fragrE   rD  )zindex.html#fragrE   rD  )z	;a=b#fragrF   rD  )z	?a=b#fragrG   rD  )z#fragrE   rD  )z	abc#@fragrE   @frag)z//abc#@fragrE   r  )z//abc:80#@fragrE   r  )z//abc#@frag:80rE   z@frag:80rF   rE   )rR   r  F)allow_fragmentsr   #T)r?   r@   rA   rO   rx  rB   rH   
assertTruegetattrendswithassertFalse)rQ   testsrR   attrexpected_fragr  rV   s          rZ   test_parse_fragmentsz%UrlParseTestCase.test_parse_fragments  s.   
 ). 	H 	H$C}.0EF H H8##0E(E(E!D\\cD\99 H H!T#u===F$$V_b999OO#FD11::3;NOOQ Q Q$$TT#r5%9%9%BBGGG!T#t<<<F$$V_mDDD$$#FD11::=IIK K K$$TT#r4%8%8%A%24 4 4$$TT#YY%7GGGH H H H H H H H H H H H H H HH	H 	Hs   #D0FF#&F#c                 |   |                      t          d          5  t          j                            dd           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            dd           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            dd           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            dd           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            d           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            d           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            d           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            d	           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            d
d           d d d            n# 1 swxY w Y   |                      t          d          5  t          j                            dd
           d d d            d S # 1 swxY w Y   d S )NzCannot mix strr   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   rC  s   http://python.org)	rb  r  r?   r@   rA   rO   rI   rP   r   r  s    rZ   test_mixed_types_rejectedz*UrlParseTestCase.test_mixed_types_rejected  s    ##I/?@@ 	= 	=L!!"2G<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=##I/?@@ 	= 	=L!!"3V<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=##I/?@@ 	= 	=L!!"2G<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=##I/?@@ 	= 	=L!!"3V<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=##I/?@@ 	N 	NL##$LMMM	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N##I/?@@ 	M 	ML##$KLLL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M##I/?@@ 	J 	JL##$HIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J##I/?@@ 	J 	JL##$HIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J##I/?@@ 	L 	LL  !46JKKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L##I/?@@ 	L 	LL  !57JKKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	Ls   !A		AA/!BB #B !C//C36C3!EE	E( FFF: G&&G*-G* H88H<?H< J

JJ0!KK!$K!!L11L58L5c                    t          |j                  }|j        }|                     |j        |           d|z  }d|z  } || } || }d}d}	|                     ||           |                     |                                |           |                     |                                |           |                     |                    |          |           |                     |                    |          |           |                     |                    ||	          |           |                     |                    ||	          |           |                     ||           |                     |                                |           |                     |                                |           |                     |                    |          |           |                     |                    |          |           |                     |                    ||	          |           |                     |                    ||	          |           d S )N)r   )r   r   strict)rc   _fields_encoded_counterpartassertIs_decoded_counterpartrB   ro  r   )
rQ   str_typenum_args
bytes_typestr_args
bytes_args
str_resultbytes_resultencodingerrorss
             rZ   _check_result_typez#UrlParseTestCase._check_result_type  sI   x'((2
j5x@@@8#h&
Xx(
!z:.X...,,..999,,..
;;;,,X66AAA,,X66
CCC,,Xv>>III,,Xv>>
KKKz222**,,j999**,,l;;;**844jAAA**844lCCC**8V<<jIII**8V<<lKKKKKr   c                     t           j        j        t           j        j        t           j        j        g}|D ]}|                     |           d S r>   )r?   r@   DefragResultSplitResultParseResultr  )rQ   result_typesresult_types      rZ   test_result_pairsz"UrlParseTestCase.test_result_pairs  sU     ,
#
,
"
,
"

 ( 	1 	1K##K0000	1 	1r   c                 L   t           j                            dd          }|                     |ddgi           t           j                            dd          }|                     |ddgi           t           j                            dd          }|                     |dd	gi           t           j                            d
d          }|                     |ddgi           t           j                            d
dd          }|                     |ddgi           d S )N	   key=Ł%E9latin-1r  key   Łé   key=Ł%C3%A9rl  r      Ł��
   key=Ł%E9-   Ł�-ignorer  r     Ł-)r?   r@   rq   rB   rQ   rV   s     rZ   test_parse_qs_encodingz'UrlParseTestCase.test_parse_qs_encoding&  s-   &&&KK%,!8999&&'9G&LL%,!8999&&'9G&LL%*>)?!@AAA&&'7'&JJ%/):!;<<<&&'7'AI ' K K%)!566666r   c                 8   t           j                            dd          }|                     |dg           t           j                            dd          }|                     |dg           t           j                            dd          }|                     |dg           t           j                            d	d          }|                     |d
g           t           j                            d	dd          }|                     |dg           d S )Nr  r  r  )r  r  r  rl  r   )r  r  r  )r  r  r  r  )r  r  )r?   r@   rh   rB   r  s     rZ   test_parse_qsl_encodingz(UrlParseTestCase.test_parse_qsl_encoding3  s   '')'LL"7!8999''(:W'MM"7!8999''(:W'MM"?!@AAA''(87'KK":!;<<<''(87AI ( K K"4!566666r   c                 J   |                      t                    5  t          j                            d                    dgdz            d           d d d            n# 1 swxY w Y   t          j                            d                    dgdz            d           d S )Nr   za=a   
   )max_num_fields)r=  r>  r?   r@   rh   joinr  s    rZ   test_parse_qsl_max_num_fieldsz.UrlParseTestCase.test_parse_qsl_max_num_fields@  s    z** 	L 	LL""388UGBJ#7#7"KKK	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	Lsxx
33BGGGGGs   9A  A$'A$c                    di fdi fdddgifddgdgd	fd
dddgifdi fdi fdddgifddgdgdfddddgifg
}|D ]\  }}|                      d|d|          5  t          j                            |d          }|                     ||d|z             t          j                            |d          }|                     ||d|z             d d d            n# 1 swxY w Y   d S )N;;;r,   r	   r   r.   r   r   r   a=1;a=2r   r      ;   ;;r0   r   r!   r2   r%   r'   r       a=1;a=2r)   r+   
Original: , Expected: 	separatorr_   )rx  r?   r@   rq   rB   )rQ   parse_qs_semicolon_casesri   rj   rV   result_bytess         rZ   test_parse_qs_separatorz(UrlParseTestCase.test_parse_qs_separatorE  s   "I2JcC5\"5'889sCj)*2JBKtdVn%VHVH==>$t-.$
  5 	R 	RLD&I4IIvIIJJ R R..ts.CC  1Cd1JKKK%|44TT4JJ  v7ID7PQQQ	R R R R R R R R R R R R R R R	R 	Rs   A7CC"	%C"	c                    dg fdg fddgfdddgfdd	d
gfdg fdg fddgfdddgfdddgfg
}|D ]\  }}|                      d|d|          5  t          j                            |d          }|                     ||d|z             t          j                            |d          }|                     ||d|z             d d d            n# 1 swxY w Y   d S )Nr  r  r,   r   r.   r   r   r  r   r   r  r  r0   r    r2   r$   r&   r  r(   r*   r  r  r  r_   )rx  r?   r@   rh   rB   )rQ   parse_qsl_semicolon_casesri   rj   rV   r  s         rZ   test_parse_qsl_separatorz)UrlParseTestCase.test_parse_qsl_separatorZ  s   "I2Jj\"\<89Z012JBK|n%nn=>,56%
! 6 	R 	RLD&I4IIvIIJJ R R///DD  1Cd1JKKK%|55dd5KK  v7ID7PQQQ	R R R R R R R R R R R R R R R	R 	Rs   A7CC	C	c                 r   |                      t          j                            d          dg           |                      t          j                            t	          d                    dg           |                      t          j                            t          d                    dg           d S )Nr   r    )rB   r?   r@   rh   	bytearray
memoryviewr  s    rZ   test_parse_qsl_bytesz%UrlParseTestCase.test_parse_qsl_bytesn  s    //77,HHH//	&0A0ABB\NSSS//
60B0BCCl^TTTTTr   c           
         t          dd          }ddd ddg i t          d          fD ]Z}|                     t          j        j        |fi |g            |                     t          t          j        j        |d           [d S )	NT)r^   strict_parsingr   r   r           ra   r  )dictr  rB   r?   r@   rh   r=  r>  )rQ   kwargsr   s      rZ   test_parse_qsl_false_valuez+UrlParseTestCase.test_parse_qsl_false_values  s    TBBBS$3B
3? 	R 	RAV\3A@@@@"EEEj&,*@!qQQQQ	R 	Rr   c                    |                      t          t          j        j        t          d                     |                      t          t          j        j        t          d                     |                      t          t          j        j        d           |                      t          t          j        j        t                                 dD ]U}|                      t                    5  t          j                            d|           d d d            n# 1 swxY w Y   V|                      t                    5  t          j                            dd           d d d            n# 1 swxY w Y   |                      t                    5  t          j                            dd           d d d            d S # 1 swxY w Y   d S )Nr   ra   )r   r   Nr   ra   r  g      ?r   r     ¦   )r=  r  r?   r@   rh   listiterobjectr>  UnicodeEncodeErrorUnicodeDecodeError)rQ   r  s     rZ   test_parse_qsl_errorsz&UrlParseTestCase.test_parse_qsl_errorsy  sF   )V\%;T&\\JJJ)V\%;T&\\JJJ)V\%;Q???)V\%;VXXFFF6 	C 	CI"":.. C C&&u	&BBBC C C C C C C C C C C C C C C122 	= 	=L""6V"<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=122 	= 	=L""5G"<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=s6   1"DD#	&D#	"E33E7:E7"GGGc                     t           j                            ddgddd          } G d d          }t           j                            d |            id          }|                     |d	           d S )
Nra   r   )r   rS     r   Tc                       e Zd Zd ZdS ):UrlParseTestCase.test_urlencode_sequences.<locals>.Trivialc                     dS )Ntrivialr   r  s    rZ   __str__zBUrlParseTestCase.test_urlencode_sequences.<locals>.Trivial.__str__  s     yr   N)__name__
__module____qualname__r  r   r   rZ   Trivialr    s#        ! ! ! ! !r   r  r	   z	a=trivial)r?   r@   r  rB   )rQ   rV   r  s      rZ   test_urlencode_sequencesz)UrlParseTestCase.test_urlencode_sequences  s     ''q!f9(E(EtLL	! 	! 	! 	! 	! 	! 	! 	! ''ggii(8$??-----r   c                    t           j                            ddi          }|                     |d           t           j                            ddit           j        j                  }|                     |d           t           j                            ddidt           j        j                  }|                     |d	           d S )
Nr	   z
some valueza=some+valuezsome value/another)	quote_viaza=some%20value%2Fanotherr   )safer  za=some%20value/another)r?   r@   r  rB   quoter  s     rZ   test_urlencode_quote_viaz)UrlParseTestCase.test_urlencode_quote_via  s    ''l(;<<000''.B(C28,2D ( F F!;<<<''.B(C-0FL<N ( P P!9:::::r   c                 0   |                      t          t          j        j        d           t          j                            d          }|                     |d           t          j                            d          }|                     |d           d S )Nr-  s   archaeological arcanazarchaeological%20arcanar   r   )r=  r  r?   r@   quote_from_bytesrB   r  s     rZ   test_quote_from_bytesz&UrlParseTestCase.test_quote_from_bytes  s}    )V\%BEJJJ../GHH!:;;;..s33$$$$$r   c                     t           j                            d          }|                     |d           t           j                            d          }|                     |d           d S )Nz	abc%20defs   abc defr   r   )r?   r@   unquote_to_bytesrB   r  s     rZ   test_unquote_to_bytesz&UrlParseTestCase.test_unquote_to_bytes  s^    ..{;;,,,..r22%%%%%r   c                     |                      t          t          j        j        dd           |                      t          t          j        j        dd           d S )Ns   foorl  r  r  )r  )r=  r  r?   r@   r  r  s    rZ   test_quote_errorsz"UrlParseTestCase.test_quote_errors  sU    )V\%7#* 	 	, 	, 	,)V\%7QQQQQr   c                    t           j                            d          }|                     |j        d           |                     |j        d           t           j                            d          }|                     |j        d           |                     |j        d           t           j                            d          }|                     |j        d           |                     |j        d           t           j                            d          }|                     |j        d           |                     |j        d           d S )Nztel:+31-641044153telz+31-641044153ztel:+31641044153z+31641044153)r?   r@   rO   rB   rC   rE   rA   )rQ   p1p2s      rZ   test_issue14072z UrlParseTestCase.test_issue14072  s    \""#677E***/222\""#566E***.111\""#677E***/222\""#566E***.11111r   c                 x   |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d	           |                      t          t          j        j        d
           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d           |                      t          t          j        j        d            |                      t          t          j        j        d!           |                      t          t          j        j        d"           |                      t          t          j        j        d#           |                      t          t          j        j        d$           |                      t          t          j        j        d%           |                      t          t          j        j        d&           |                      t          t          j        j        d'           |                      t          t          j        j        d(           |                      t          t          j        j        d)           |                      t          t          j        j        d*           |                      t          t          j        j        d+           d S ),Nz&Scheme://user@[192.0.2.146]/Path?Queryz-Scheme://user@[important.com:8000]/Path?Queryz#Scheme://user@[v123r.IP]/Path?Queryz Scheme://user@[v12ae]/Path?QueryzScheme://user@[v.IP]/Path?Queryz Scheme://user@[v123.]/Path?QueryzScheme://user@[v]/Path?Queryz5Scheme://user@[0439:23af::2309::fae7:1234]/Path?QueryzJScheme://user@[0439:23af:2309::fae7:1234:2342:438e:192.0.2.146]/Path?QueryzScheme://user@]v6a.ip[/Pathzscheme://prefix.[v6a.ip]zscheme://[v6a.ip].suffixzscheme://prefix.[v6a.ip]/zscheme://[v6a.ip].suffix/zscheme://prefix.[v6a.ip]?zscheme://[v6a.ip].suffix?zscheme://prefix.[::1]zscheme://[::1].suffixzscheme://prefix.[::1]/zscheme://[::1].suffix/zscheme://prefix.[::1]?zscheme://[::1].suffix?zscheme://prefix.[::1]:azscheme://[::1].suffix:azscheme://prefix.[::1]:a1zscheme://[::1].suffix:a1zscheme://prefix.[::1]:1azscheme://[::1].suffix:1azscheme://prefix.[::1]:zscheme://[::1].suffix:/zscheme://prefix.[::1]:?zscheme://user@prefix.[v6a.ip]zscheme://user@[v6a.ip].suffixzscheme://[v6a.ipzscheme://v6a.ip]zscheme://]v6a.ip[zscheme://]v6a.ipzscheme://v6a.ip[zscheme://prefix.[v6a.ipzscheme://v6a.ip].suffixzscheme://prefix]v6a.ip[suffixzscheme://prefix]v6a.ipzscheme://v6a.ip[suffix)r=  r>  r?   r@   rO   r  s    rZ   test_invalid_bracketed_hostsz-UrlParseTestCase.test_invalid_bracketed_hosts  s   *fl&;=efff*fl&;=lmmm*fl&;=bccc*fl&;=_```*fl&;=^___*fl&;=_```*fl&;=[\\\*fl&;=tuuu*fl&;  >J  	K  	K  	K*fl&;=Z[[[*fl&;=WXXX*fl&;=WXXX*fl&;=XYYY*fl&;=XYYY*fl&;=XYYY*fl&;=XYYY*fl&;=TUUU*fl&;=TUUU*fl&;=UVVV*fl&;=UVVV*fl&;=UVVV*fl&;=UVVV*fl&;=VWWW*fl&;=VWWW*fl&;=WXXX*fl&;=WXXX*fl&;=WXXX*fl&;=WXXX*fl&;=UVVV*fl&;=VWWW*fl&;=VWWW*fl&;=\]]]*fl&;=\]]]*fl&;=OPPP*fl&;=OPPP*fl&;=PQQQ*fl&;=OPPP*fl&;=OPPP*fl&;=VWWW*fl&;=VWWW*fl&;=\]]]*fl&;=UVVV*fl&;=UVVVVVr   c                    t           j                            d          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d           t           j                            d          }|                     |j        d           |                     |j        d           |                     |j        d           |                     |j        d            t           j                            d          }|                     |j        d	           |                     |j        d           |                     |j        d           d S )
Nz&scheme://user@[v6a.ip]:1234/path?queryzv6a.ipuser/pathi  z4scheme://user@[0439:23af:2309::fae7%test]/path?queryz0439:23af:2309::fae7%testzEscheme://user@[0439:23af:2309::fae7:1234:192.0.2.146%test]/path?queryz*0439:23af:2309::fae7:1234:192.0.2.146%test)	r?   r@   rO   rB   rM   rK   rE   rN   r  )rQ   r   r!  p3s       rZ   test_splitting_bracketed_hostsz/UrlParseTestCase.test_splitting_bracketed_hosts  sR   \""#KLLh///f---'***$'''\""#YZZ&ABBBf---'***bgt$$$\""#jkk&RSSSf---'*****r   c                 p   d}t           j                            d          }|                     t          |          5  |j         d d d            n# 1 swxY w Y   t           j                            d          }|                     t          |          5  |j         d d d            d S # 1 swxY w Y   d S )Nz3Port could not be cast to integer value as 'oracle'z%http://Server=sde; Service=sde:oracle)r?   r@   rA   rb  r>  rN   rO   )rQ   messager   r!  s       rZ   !test_port_casting_failure_messagez2UrlParseTestCase.test_port_casting_failure_message  s(   G\""#JKK##J88 	 	GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 \""#JKK##J88 	 	GG	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AAAB++B/2B/c                    t           j                            d          }|                     |j        d           |                     |j        d           |                     |j        d           t           j                            d          }|                     |j        d           |                     |j        d           |                     |j        d           t           j                            d          }|                     |j        d           |                     |j        d	           |                     |j        d
           t           j                            d          }|                     |j        d           |                     |j        d           |                     |j        d           d S )Nz"tel:123-4;phone-context=+1-650-516r  z123-4zphone-context=+1-650-516ztel:+1-201-555-0123z+1-201-555-0123r   z"tel:7042;phone-context=example.com7042zphone-context=example.comz%tel:863-1234;phone-context=+1-914-555z863-1234zphone-context=+1-914-555)r?   r@   rA   rB   rC   rE   rF   )rQ   r   s     rZ   test_telurl_paramsz#UrlParseTestCase.test_telurl_params  s   \""#GHHE***'***$>???\""#899E***"3444B'''\""#GHHE***&)))$?@@@\""#JKKE****---$>?????r   c                     t           j                            t           j        j                  }|                     dt          |                     d S )NQuoter)r?   r@   _Quoter_ALWAYS_SAFEassertInrepr)rQ   quoters     rZ   test_Quoter_reprz!UrlParseTestCase.test_Quoter_repr  s<    %%fl&?@@hV-----r   c                 B    t           j                                         d S r>   )r?   r@   clear_cacher  s    rZ   "test_clear_cache_for_code_coveragez3UrlParseTestCase.test_clear_cache_for_code_coverage   s      """""r   c                     	 |                      t                    5  t          j        j        }d d d            d S # 1 swxY w Y   d S r>   )r=  AttributeErrorr?   r@   this_does_not_exist)rQ   unuseds     rZ   !test_urllib_parse_getattr_failurez2UrlParseTestCase.test_urllib_parse_getattr_failure#  s    C~.. 	6 	6\5F	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6 	6s   ;??c                 P   g }h d}t          t          j                  D ]`}|                    d          s||v rt	          t          j        |          }t	          |dd           dk    r|                    |           a|                     t          j        j        |           d S )N>   unwrapsplittagto_bytes	splitattr	splithost	splitport	splittype	splituser
ResultBase
splitnport
splitquery
splitvaluer9  splitpasswdrh  r  zurllib.parse)dirr?   r@   
startswithr  appendassertCountEqual__all__)rQ   r   undocumentednamer  s        rZ   test_allzUrlParseTestCase.test_all(  s    
 
 
 %% 	& 	&Ds## t|';';V\400Fv|T22nDD%%%fl2H=====r   c                    dd D             fdt          t          t          dt          j                            D             }|                     d|           |                     d|           t          j                            d           | 	                    t                    5  t          j                            d           d d d            n# 1 swxY w Y   d	D ]}d
D ]}|D ]}d                    ||                    |                    }|                     |d                    t          |                              5  | 	                    t                    5  t          j                            |           d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   ̌ьd S )Nz/:#?@c                 R    h | ]$}d                      t          |                    %S ){:04X})formatord)rd   r   s     rZ   	<setcomp>z?UrlParseTestCase.test_urlsplit_normalization.<locals>.<setcomp>=  s*    DDDX__SVV,,DDDr   c                     g | ]R}t          j        |          r<t          t          j        |                                                    z  r|vP|SS r   )unicodedatadecompositionsetrT   )rd   r   	hex_charsillegal_charss     rZ   rf   z@UrlParseTestCase.test_urlsplit_normalization.<locals>.<listcomp>>  ss     
 
 
(++
 S!:1!=!=!C!C!E!EFFF
 &&  '&&r      u   ℀u   ＃u   http://プ:80u   http://プ︓80)r   r   r  )znetloc{}false.netloczn{}user@netlocz{}://{}/pathrX  )rR   char)mapchrrg  sys
maxunicoder4  r?   r@   rO   r=  r>  rY  rx  rZ  )rQ   denorm_charsrC   rD   r   rR   r`  ra  s         @@rZ   test_urlsplit_normalizationz,UrlParseTestCase.test_urlsplit_normalization8  s     DDmDDD	
 
 
 
 
3c3> : :;;
 
 
 	h---h--- 	6777z** 	A 	AL!!"?@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A / 	7 	7FD 7 7% 7 7A(//a8H8HIIC#HOOCFF4K4KLL 7 7!..z:: 7 7"L11#6667 7 7 7 7 7 7 7 7 7 7 7 7 7 77 7 7 7 7 7 7 7 7 7 7 7 7 7 777	7 	7sH   0 CC #C F1	. FF1	FF1	!F"F1	1F58F5r>   ):r  r  r  r[   rl   rr   r   r   r   r   r   r  r  r$  r)  r/  rA  rN  rP  rc  ri  rs  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/  r7  r:  r?  rU  ri  r   r   rZ   r<   r<   h   s       38 38 38 38j7 7 77 7 7?5 ?5 ?5B; ; ;@$= $= $=LJ J JS S S"A "A "A`@ @ @
%J %J %JZ7B 7B 7Br5& 5& 5&n0N 0N 0Nd4 4 4.M M M[ [ [z#t #t #tJ9D 9D 9Dv# # #&; ; ;$'* '* '*RU U U@ @ @&@ @ @$D D DV V V*@ @ @H H HBL L L0L L L21 1 17 7 77 7 7H H H
R R R*R R R(U U U
R R R= = =. . .; ; ;% % %& & &R R R
2 2 2+W +W +WZ+ + +   @ @ @*. . .# # #6 6 6
> > > 7 7 7 7 7r   r<   c                   X    e Zd Z	 d Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd ZdS )Utility_Testsc                 ^   t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           d S )Nztype:opaquestring)rJ  opaquestringrm  )Nrm  :opaquestring)Nrn  ztype:)rJ  r   ztype:opaque:string)rJ  zopaque:string)r?   r@   
_splittyperB   )rQ   rG  s     rZ   test_splittypezUtility_Tests.test_splittypeZ  s    L+	#6779QRRR>224JKKK?335LMMM7++\:::#788:STTTTTr   c                    t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           d S )Nz%//www.example.org:80/foo/bar/baz.html)www.example.org:80/foo/bar/baz.htmlz//www.example.org:80)rr  r   rs  )Nrs  z//127.0.0.1#@host.com)	127.0.0.1/#@host.comz//127.0.0.1#@host.com:80)rt  z/#@host.com:80z//127.0.0.1:80#@host.com)z127.0.0.1:80ru  z///file)r   z/filez//example.net/file;)example.netz/file;z//example.net/file?)rv  z/file?z//example.net/file#)rv  z/file#)r?   r@   
_splithostrB   )rQ   rE  s     rZ   test_splithostzUtility_Tests.test_splithostb  s   L+	#JKKD	F 	F 	F#9::3	5 	5 	5#6774	6 	6 	6 	#:;;5	7 	7 	7#=>>8	: 	: 	:#=>>8	: 	: 	: 	9--&	( 	( 	( 	#8992	4 	4 	4#8992	4 	4 	4#8992	4 	4 	4 	4 	4r   c                 ^   t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           d S )NrU  )	User:Passwww.python.org:080z@www.python.org:080)r   r{  r{  )Nr{  z
User:Pass@)rz  r   rZ  )zUser@example.com:Passr{  )r?   r@   
_splituserrB   )rQ   rH  s     rZ   test_splituserzUtility_Tests.test_splituser  s    L+	#ABB<	> 	> 	>#8993	5 	5 	5#7885	7 	7 	7<00*	, 	, 	,#MNNH	J 	J 	J 	J 	Jr   c                 N   t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           d S )Nzuser:ab)r&  abzuser:a
b)r&  za
bzuser:a	b)r&  za	bzuser:ab)r&  zabzuser:ab)r&  zabzuser:ab)r&  zabzuser:a:b)r&  za:bzuser:a b)r&  r   z	user 2:ab)zuser 2r  z
user+1:a+b)zuser+1za+bzuser:)r&  r   r&  )r&  Nz:ab)r   r  )r?   r@   _splitpasswdrB   )rQ   rM  s     rZ   test_splitpasswdzUtility_Tests.test_splitpasswd  s    l/Y//@@@[113CDDD[113CDDD[113CDDD[113CDDD[113CDDDZ00/BBBZ00/BBB[113CDDD\224EFFFW--|<<<V,,n===U++Z88888r   c                    t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d	           |                      |d
          d           |                      |d          d           |                      |d          d           d S )N	parrot:88)parrot88r  r  Nparrot:rt  )rt  Nparrot:cheese)r  Nz[::1]:88)[::1]r  r  )r  Nz:88)r   r  )r?   r@   
_splitportrB   )rQ   rF  s     rZ   test_splitportzUtility_Tests.test_splitport  s   L+	;//1ABBB8,,.>???9--/?@@@;//1DEEE?335LMMM:..@@@7++_===5)):66666r   c                    t           j        j        }|                      |d          d           |                      |d          d           |                      |dd          d           |                      |d          d           |                      |dd          d           |                      |d          d	           |                      |dd          d
           |                      |d          d           |                      |dd          d           |                      |d          d           d S )Nr  )r  rm  r  )r  7   )r  r  r  rt  )rt  r  )rt  r  r  r  zparrot: +1_0 )r?   r@   _splitnportrB   )rQ   rJ  s     rZ   test_splitnportzUtility_Tests.test_splitnport  s_   \-
K00.AAAH--~>>>Hb11>BBBI..???Ir22NCCCK002CDDDK446GHHHO446FGGGOR88:JKKKO446FGGGGGr   c                     t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           d S )	Nhttp://python.org/fake?foo=bar)http://python.org/fakefoo=barzhttp://python.org/fake?foo=bar?)r  r   r  )r  Nz?foo=bar)r   r  )r?   r@   _splitqueryrB   )rQ   rK  s     rZ   test_splitqueryzUtility_Tests.test_splitquery  s     \-
$DEE>	@ 	@ 	@$EFF?	A 	A 	A$<==9	; 	; 	;J//AAAAAr   c                 ^   t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           d S )Nhttp://example.com?foo=bar#baz)http://example.com?foo=barbazzhttp://example.com?foo=bar#)r  r   z#baz)r   r  r  )r  Nz"http://example.com?foo=bar#baz#boo)r  boo)r?   r@   	_splittagrB   )rQ   rB  s     rZ   test_splittagzUtility_Tests.test_splittag  s    <)"BCC>	@ 	@ 	@"?@@;	= 	= 	=&));777">??=	? 	? 	?"FGGB	D 	D 	D 	D 	Dr   c                 :   t           j        j        }|                      |d          dddgf           |                      |d          ddgf           |                      |d          dddgf           |                      |d          dg f           d S )Nz/path;attr1=value1;attr2=value2r'  zattr1=value1zattr2=value2z/path;r   z;attr1=value1;attr2=value2)r?   r@   
_splitattrrB   )rQ   rD  s     rZ   test_splitattrzUtility_Tests.test_splitattr  s    L+	#DEE!NN#CD	F 	F 	F8,,wo>>>#?@@~~>?	A 	A 	A7++gr];;;;;r   c                 ^   t           j        j        }|                      |d          d           |                      |d          d           |                      |d          d           |                      |d          d           |                      |d	          d
           d S )Nr  )r-  barzfoo=)r-  r   z=bar)r   r  foobar)r  Nzfoo=bar=baz)r-  zbar=baz)r?   r@   _splitvaluerB   )rQ   rL  s     rZ   test_splitvaluezUtility_Tests.test_splitvalue  s     \-
I..???F++[999F++[999H--/?@@@M224FGGGGGr   c                     t           j                            d          }|                     |d           |                     t
          t           j        j        d           d S )Nzhttp://www.python.orgu   http://www.python.org/mediæval)r?   r@   	_to_bytesrB   r=  UnicodeErrorr  s     rZ   test_to_byteszUtility_Tests.test_to_bytes  sb    ''(?@@!8999,(>?	A 	A 	A 	A 	Ar   c                 z    dD ]7}t           j                            |          }|                     |d           8d S )N)z<URL:scheme://host/path>z<scheme://host/path>zURL:scheme://host/pathscheme://host/pathr  )r?   r@   rA  rB   )rQ   wrapped_urlrR   s      rZ   test_unwrapzUtility_Tests.test_unwrap  sM    L 	8 	8K,%%k22CS"67777	8 	8r   N)r  r  r  rp  rx  r}  r  r  r  r  r  r  r  r  r  r   r   rZ   rk  rk  V  s        GU U U4 4 4:J J J9 9 9$	7 	7 	7H H H
B 
B 
B
D 
D 
D< < <H H HA A A8 8 8 8 8r   rk  c                   V    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd ZdS )DeprecationTestc                 &   |                      t                    5 }t          j        j        }|                     |t          j        j                   d d d            n# 1 swxY w Y   |                     dt          |j	                             d S )NzQuoter will be removed)
assertWarnsDeprecationWarningr?   r@   r1  r  r2  r4  strwarning)rQ   cm	old_classs      rZ   test_Quoter_deprecationz'DeprecationTest.test_Quoter_deprecation  s    011 	;R+IMM)V\%9:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	.BJ@@@@@s   7AA"%A"c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zUurllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rG  rB   r  r  rQ   r  s     rZ   test_splittype_deprecationz*DeprecationTest.test_splittype_deprecation      011 	'RL""2&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'RZ?	@ 	@ 	@ 	@ 	@    AAAc                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rE  rB   r  r  r  s     rZ   test_splithost_deprecationz*DeprecationTest.test_splithost_deprecation  r  r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rH  rB   r  r  r  s     rZ   test_splituser_deprecationz*DeprecationTest.test_splituser_deprecation  r  r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rM  rB   r  r  r  s     rZ   test_splitpasswd_deprecationz,DeprecationTest.test_splitpasswd_deprecation  s    011 	)RL$$R(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)RZ?	@ 	@ 	@ 	@ 	@r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rF  rB   r  r  r  s     rZ   test_splitport_deprecationz*DeprecationTest.test_splitport_deprecation  r  r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rJ  rB   r  r  r  s     rZ   test_splitnport_deprecationz+DeprecationTest.test_splitnport_deprecation      011 	(RL##B'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(RZ?	@ 	@ 	@ 	@ 	@r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rK  rB   r  r  r  s     rZ   test_splitquery_deprecationz+DeprecationTest.test_splitquery_deprecation   r  r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rB  rB   r  r  r  s     rZ   test_splittag_deprecationz)DeprecationTest.test_splittag_deprecation'  s    011 	&RL!!"%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&RZ?	@ 	@ 	@ 	@ 	@r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rD  rB   r  r  r  s     rZ   test_splitattr_deprecationz*DeprecationTest.test_splitattr_deprecation.  r  r  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   zWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() instead)r  r  r?   r@   rL  rB   r  r  r  s     rZ   test_splitvalue_deprecationz+DeprecationTest.test_splitvalue_deprecation5  s    011 	(RL##B'''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(RZ@	A 	A 	A 	A 	Ar  c                     |                      t                    5 }t          j                            d           d d d            n# 1 swxY w Y   |                     t          |j                  d           d S )Nr   z/urllib.parse.to_bytes() is deprecated as of 3.8)r  r  r?   r@   rC  rB   r  r  r  s     rZ   test_to_bytes_deprecationz)DeprecationTest.test_to_bytes_deprecation<  s    011 	&RL!!"%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&RZJ	L 	L 	L 	L 	Lr  N)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   rZ   r  r    s        A A A@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @@ @ @A A AL L L L Lr   r  __main__)rf  r]  unittesturllib.parser?   r  r#  r(  r.  rg   rp   TestCaser<   rk  r  r  mainr   r   rZ   <module>r     s9   



         %##
)H)"I) 
2J) 	8*	)
 
I;) 	9+) 
I;) |n) ) Z()) >"#) j\) \<01) Z()) 	"I)  
2J!)" BK#)$ 
J<%)& [M')( 
K=))* [M+),  -). .!"/)0 ,-.1)2 $%&3)4 |n5)6 nn567)8 ,-.9): k];)< '()=)> }o?)@ *+,A)D '()E)F )*+G)H %&'I)J 678K)L 234M)N &'(O)P $%&Q) \*H*"I* 
2J* 	2t*	*
 
B;* 	3+* 
C";* sUGn* * se3%(()* 3	"#* cC5\* 5'001* sCj!"* 	"I*  
2J!*" BK#*$ 
C#<%*& S4&M'*( 
D3%=)** TC5M+*, vh -*. &4&!"/*0 tf--.1*2 D8*%&3*4 tdVn5*6 VHVH5567*8 $t%&9*: dSE];*< S;-()=*> utfo?*@ d\?+,A*B 0123C*F Xx()G*H x&*+I*J H:&'K*L K+78M*N k]34O*P GgY'(Q*R 'G9%&S* Xl7 l7 l7 l7 l7x( l7 l7 l7\'U8 U8 U8 U8 U8H% U8 U8 U8pRL RL RL RL RLh' RL RL RLj zHMOOOOO r   