
    7bhE                       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                           yy)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                   X   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 Z9y):UrlParseTestCaseNc                 
   ||}t         j                  j                  |      }| j                  ||       |j                  |j
                  |j                  |j                  |j                  |j                  f}| j                  ||       t         j                  j                  |      }| j                  ||       | j                  ||j                                t         j                  j                  |j                               }| j                  |j                         |j                                | j                  ||       | j                  |j                  |j                         | j                  |j
                  |j
                         | j                  |j                  |j                         | 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                  |j                  |j                  f}| j                  ||       t         j                  j%                  |      }| j                  ||       | j                  ||j                                t         j                  j#                  |j                               }| j                  |j                         |j                                | j                  ||       | j                  |j                  |j                         | j                  |j
                  |j
                         | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                  |j                         | j                  |j                   |j                          y N)urllibparseurlparseassertSequenceEqualschemenetlocpathparamsqueryfragment
urlunparsegeturlassertEqualusernamepasswordhostnameporturlsplit
urlunsplit)	selfurlparsedspliturl2resulttresult2result3s	            </opt/python-3.12.12/usr/lib/python3.12/test/test_urlparse.pycheckRoundtripsz UrlParseTestCase.checkRoundtripsj   s   <D&&s+  0]]FMM6;;]]FLL&//;  F+,,))&1  $/  &--/: ,,''8)6==?;  &16==96==96;;76==96<<8))6??;))6??;))6??;))6??;6;;7 &&s+  /]]FMM6;;\\6??,  E*,,))&1  $/  &--/: ,,''8)6==?;  &16==96==96;;76<<8))6??;))6??;))6??;))6??;6;;7r   c                 B   t         D ]  \  }}t        j                  j                  |d      }| j	                  ||d|z         |D cg c]  }t        |d         s| }}t        j                  j                  |d      }| j	                  ||d|z          y c c}w )NTkeep_blank_valuesError parsing %r   F)parse_qsl_test_casesr?   r@   	parse_qslrK   lenrR   origexpectrW   vexpect_without_blankss         r[   test_qslzUrlParseTestCase.test_qsl   s    0LD&\\++DD+IFVV-?$-FG06$D1#ad)Q!$D\\++DE+JFV%:.57 1 %Es   BBc                 N   t         D ]  \  }}t        j                  j                  |d      }| j	                  ||d|z         |D ci c]  }t        ||   d         r|||    }}t        j                  j                  |d      }| j	                  ||d|z          y c c}w )NTr^   r`   r   F)parse_qs_test_casesr?   r@   parse_qsrK   rd   re   s         r[   test_qszUrlParseTestCase.test_qs   s    /LD&\\**44*HFVV-?$-FG.4%K.4F1IaL8I &'q	\.4 " %K\\**45*IFV%:.57 0%Ks   B"c                     g d}d }|D cg c]
  } ||       }}|dgz  }||z   D ]3  \  }}}| j                  |      5  | j                  |||       d d d        5 y c c}w # 1 sw Y   ExY w)N))path/to/file)r   r   rp   r   r   r   )r   r   rp   r   r   )/path/to/filer   r   rq   r   r   r   r   r   rq   r   r   )//path/to/file)r   rE   /to/filer   r   r   )r   rE   ru   r   r   )z////path/to/file)r   r   rt   r   r   r   )r   r   rt   r   r   )z/////path/to/file)r   r   ///path/to/filer   r   r   )r   r   rv   r   r   )zscheme:path/to/file)rC   r   rp   r   r   r   )rC   r   rp   r   r   )scheme:/path/to/filerC   r   rq   r   r   r   rC   r   rq   r   r   )zscheme://path/to/file)rC   rE   ru   r   r   r   )rC   rE   ru   r   r   )zscheme:////path/to/file)rC   r   rt   r   r   r   )rC   r   rt   r   r   )zscheme://///path/to/file)rC   r   rv   r   r   r   )rC   r   rv   r   r   )zfile:tmp/junk.txt)filer   tmp/junk.txtr   r   r   )rz   r   r{   r   r   )file:///tmp/junk.txtrz   r   /tmp/junk.txtr   r   r   rz   r   r~   r   r   )zfile:////tmp/junk.txt)rz   r   //tmp/junk.txtr   r   r   )rz   r   r   r   r   )zfile://///tmp/junk.txt)rz   r   ///tmp/junk.txtr   r   r   )rz   r   r   r   r   )zhttp:tmp/junk.txt)httpr   r{   r   r   r   )r   r   r{   r   r   )zhttp://example.com/tmp/junk.txt)r   example.comr~   r   r   r   )r   r   r~   r   r   )z http:///example.com/tmp/junk.txt)r   r   /example.com/tmp/junk.txtr   r   r   )r   r   r   r   r   )z!http:////example.com/tmp/junk.txt)r   r   //example.com/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   )zEitms-services://?action=download-manifest&url=https://example.com/app)itms-servicesr   r   r   4action=download-manifest&url=https://example.com/appr   )r   r   r   r   r   )+scheme:path/to/file)r   r   r   r   r   r   )r   r   r   r   r   )sch_me:path/to/file)r   r   r   r   r   r   )r   r   r   r   r   c                 |    | d   j                  d      t        d | d   D              t        d | d   D              fS )Nr   asciic              3   >   K   | ]  }|j                  d         ywr   Nencode.0xs     r[   	<genexpr>zDUrlParseTestCase.test_roundtrips.<locals>._encode.<locals>.<genexpr>       :T!((7+T   ra   c              3   >   K   | ]  }|j                  d         ywr   r   r   s     r[   r   zDUrlParseTestCase.test_roundtrips.<locals>._encode.<locals>.<genexpr>  r   r      r   tuplerX   s    r[   _encodez1UrlParseTestCase.test_roundtrips.<locals>._encode  @    aDKK(:QqT:::QqT::< <r   )   schème:path/to/file)r   r   r   r   r   r   )r   r   r   r   r   subTestr\   )rR   	str_casesr   r   bytes_casesrS   rT   rU   s           r[   test_roundtripsz UrlParseTestCase.test_roundtrips   s    W	p	< ,559awqz957 		
 #,k"9Cc"$$S&%8 #" #: 6 #"s   A A$$A-	c                     g d}d }|D cg c]
  } ||       }}||z   D ]5  \  }}}}| j                  |      5  | j                  ||||       d d d        7 y c c}w # 1 sw Y   GxY w)N))rv   rq   rr   rs   )zscheme:///path/to/filerw   rx   ry   )zfile:/tmp/junk.txtr|   r}   r   )zhttp:/tmp/junk.txtzhttp:///tmp/junk.txt)r   r   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   j                  d      | d   j                  d      t        d | d   D              t        d | d   D              fS )Nr   r   ra   c              3   >   K   | ]  }|j                  d         ywr   r   r   s     r[   r   zRUrlParseTestCase.test_roundtrips_normalization.<locals>._encode.<locals>.<genexpr>3  r   r   r   c              3   >   K   | ]  }|j                  d         ywr   r   r   s     r[   r   zRUrlParseTestCase.test_roundtrips_normalization.<locals>._encode.<locals>.<genexpr>4  r   r      r   r   s    r[   r   z?UrlParseTestCase.test_roundtrips_normalization.<locals>._encode0  sP    aDKK(aDKK(:QqT:::QqT::< <r   r   )	rR   r   r   r   r   rS   rV   rT   rU   s	            r[   test_roundtrips_normalizationz.UrlParseTestCase.test_roundtrips_normalization  su    
	,	<
 ,559awqz95(1K(?$Cvuc"$$S&%> #" )@ 6""s   AA  A)	c                     g d}d }|D cg c]
  } ||       }}d}d}||f}||f}||fD ];  \  }	}
|	D ]1  }|
D ]*  \  }}}||z   }|f|z   }|f|z   }| j                  |||       , 3 = y c c}w )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   j                  d      t        d | d   D              t        d | d   D              fS )Nr   r   c              3   >   K   | ]  }|j                  d         ywr   r   r   s     r[   r   zIUrlParseTestCase.test_http_roundtrips.<locals>._encode.<locals>.<genexpr>Q  r   r   ra   c              3   >   K   | ]  }|j                  d         ywr   r   r   s     r[   r   zIUrlParseTestCase.test_http_roundtrips.<locals>._encode.<locals>.<genexpr>R  r   r   r   r   r   s    r[   r   z6UrlParseTestCase.test_http_roundtrips.<locals>._encodeO  r   r   )r   r   )   http   https)r\   )rR   r   r   r   r   str_schemesbytes_schemes	str_testsbytes_testsschemes
test_casesrC   rS   rT   rU   s                  r[   test_http_roundtripsz%UrlParseTestCase.test_http_roundtrips:  s    	"	< ,559awqz95'+*	#[0$-{#;GZ!*4&C 3,C$Y/F#I-E((fe<	 +5 " $< 6s   A,c                 *   | j                  ||      5  | j                  t        j                  j	                  ||      |       |j                  d      }|j                  d      }|j                  d      }| j                  t        j                  j	                  ||      |       t        j                  j                  t        j                  j                  |            }| j                  t        j                  j	                  ||      |       t        j                  j                  t        j                  j                  |            }| j                  t        j                  j	                  ||      |       d d d        y # 1 sw Y   y xY w)N)baserelurlr   )r   rK   r?   r@   urljoinr   rQ   rP   )rR   r   r   expectedbasebrelurlb	expectedbs          r[   	checkJoinzUrlParseTestCase.checkJoin`  s   \\tF\3V\\11$?JKK(EmmG,G 0IV\\11%A9M\\,,V\\-B-B6-JKFV\\11$?Jll--fll.C.CG.LMGV\\11%A9M 433s   E,F		Fc                    g d}|D cg c]  }|j                  d       }}||z   D ]  }| j                  t        j                  j	                  t        j                  j                  |            |       | j                  t        j                  j                  t        j                  j                  |            |        y c c}w )N)Pythonz./Pythonx-newscheme://foo.com/stuffzx://yzx:/yzx:/r   r   )r   rK   r?   r@   rQ   rP   rI   rA   )rR   r   r   r   us        r[   test_unparse_parsez#UrlParseTestCase.test_unparse_parsem  s    b	2;<)Qqxx()<[(AV\\44V\\5J5J15MNPQRV\\44V\\5J5J15MNPQR ) =s   Cc                    | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        d	d
       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        d d       | j                  t        d!d"       | j                  t        d#d$       | j                  t        d%d$       | j                  t        d&d       | j                  t        d'd(       | j                  t        d)d*       | j                  t        d+d,       | j                  t        d-d.       | j                  t        d/d0       | j                  t        d1d"       | j                  t        d2d       | j                  t        d3d4       | j                  t        d5d6       y )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rR   s    r[   test_RFC1808zUrlParseTestCase.test_RFC1808t  s   |UE2|S*:;|U,<=|T+<=|T<8|UJ7|U,>?|Y0FG|T+AB|U,>?|Y0FG|W.BC|U,>?|Y0FG|S/:|T?;|T=9|UM:|V^<|Wk:|X{;|Y= 	|R)?@|T+<=|T+<=|U,>?|U,>?|X~>|W.?@|W.@A|X/?@r   c                 b    | j                  t        j                  j                  d      d       y )Nzmailto:1337@example.org)mailtor   z1337@example.orgr   r   r   rK   r?   r@   rA   r  s    r[   test_RFC2368zUrlParseTestCase.test_RFC2368  s&    ../HI>	@r   c                 V   | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        d	d
       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd        | j                  t        d!d        | j                  t        d"d       | j                  t        d#t               | j                  t        d$d%       | j                  t        d&d'       | j                  t        d(d)       | j                  t        d*d+       | j                  t        d,d       | j                  t        d-d       | j                  t        d.d/       | j                  t        d0d1       | j                  t        d2d3       | j                  t        d4d5       | j                  t        d6d7       | j                  t        d8d9       | j                  t        d:d;       | j                  t        d<d=       y )>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    r[   test_RFC2396zUrlParseTestCase.test_RFC2396  sJ    	|UE2|S*:;|U,<=|T+<=|T<8|UJ7|U,>?|T+AB|U,>?|W.BC|U,>?|Y0FG|S/:|T?;|T=9|UM:|V^<|Wk:|X{;|Y=|R6|T+<=|T+<=|U,>?|U,>?|X~>|W.?@|W.@A|X/?@|[2HI|\3CD|Y0FG|Z1HI|Y0FG|Z1HIr   c                 @   | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        d	d
       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        d d!       | j                  t        d"d!       | j                  t        d#d$       | j                  t        d%d&       | j                  t        d'd&       | j                  t        d(d       | j                  t        d)d       | j                  t        d)d       | j                  t        d*d       | j                  t        d+d       | j                  t        d,d       | j                  t        d-d.       | j                  t        d/d0       | j                  t        d1d2       | j                  t        d3d4       | j                  t        d5d$       | j                  t        d6d
       | j                  t        d7d8       | j                  t        d9d:       | j                  t        d;d<       | j                  t        d=d>       | j                  t        d?d@       | j                  t        dAdB       | j                  t        dCdD       | j                  t        dEdF       | j                  t        dGd       | j                  dHdd       y )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    r[   test_RFC3986zUrlParseTestCase.test_RFC3986  s   |T*>?|T+<=|U51|S)9:|U+;<|T*;<|T,7|U:6|T*>?|U+=>|T*@A|U+=>|W-AB|T*;<|U+=>|Y/EF|R(<=|S9|T/:|T-8|U=9|VN;|W[9|Xk:|Y|<|\<@ 	|\,?|_\B|VL9|W\:|T*;<|T*;<|U+=>|U+=>|Xn=|W->?|W-?@|X.>?|[1GH|\2BC|Y/EF|Z0GH|Y/EF|Z0GH|X.>? 	($/@Ar   c                 4   | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd	       | j                  t        d
d       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        dd       | j                  t        d d	       | j                  t        d!d"       | j                  t        d#d$       | j                  t        dd       | j                  t        dd       | j                  t        d%d       | j                  t        d&d       | j                  t        d'd       | j                  d(dd(       | j                  d)dd       | j                  d)d*d*       | j                  d+d,d-       | j                  d.d,d/       | j                  d0dd1       | j                  d2dd3       | j                  t        d4z   d5t        d6z          | j                  d7d8d9       | j                  d:d8d;       | j                  d7d<d=       | j                  d:d<d=       | j                  d7d>d?       | j                  dd8d=       | j                  d@dAdA       y )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    r[   test_urljoinszUrlParseTestCase.test_urljoins  s   {E%0{H-=>{G,<={C(89{E*:;{D):;{D6{E*5{D);<{E*<={I.DE{C8{D9{D7{E-8{F>:{GK8{Il;{H^<{G,=>{G,>?{H-=>{H-=>{G,<={I.@A{J/AB{N3IJz4
3r12HIr>>:.8OP2F<WXz#j1{3{3 	{S(%v1EF 	*L:MN)<9JK*M?K)=/J*K9KL}lOD 	sC%r   c                    g d}d }|D cg c]
  } ||       }}||z   D ]O  \  }}}t         j                  j                  |      }| j                  |j                  |j
                  f||f       Q g d}|D cg c]  }|j                  d       }}||z   D ]1  }	| j                  t        t         j                  j                  |	       3 y c c}w c c}w )N))z http://Test.python.org:5432/foo/test.python.org8  )zhttp://12.34.56.78:5432/foo/12.34.56.78r/  )zhttp://[::1]:5432/foo/::1r/  )zhttp://[dead:beef::1]:5432/foo/dead:beef::1r/  )zhttp://[dead:beef::]:5432/foo/dead:beef::r/  )z:http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]:5432/foo/'dead:beef:cafe:5417:affe:8fa3:deaf:feedr/  )z http://[::12.34.56.78]:5432/foo/::12.34.56.78r/  )z%http://[::ffff:12.34.56.78]:5432/foo/::ffff:12.34.56.78r/  )zhttp://Test.python.org/foo/r.  N)zhttp://12.34.56.78/foo/r0  N)zhttp://[::1]/foo/r1  N)zhttp://[dead:beef::1]/foo/r2  N)zhttp://[dead:beef::]/foo/r3  N)z5http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/r4  N)zhttp://[::12.34.56.78]/foo/r5  N)z http://[::ffff:12.34.56.78]/foo/r6  N)zhttp://Test.python.org:/foo/r.  N)zhttp://12.34.56.78:/foo/r0  N)zhttp://[::1]:/foo/r1  N)zhttp://[dead:beef::1]:/foo/r2  N)zhttp://[dead:beef::]:/foo/r3  N)z6http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]:/foo/r4  N)zhttp://[::12.34.56.78]:/foo/r5  N)z!http://[::ffff:12.34.56.78]:/foo/r6  Nc                 Z    | d   j                  d      | d   j                  d      | d   fS )Nr   r   ra   r   r   r   s    r[   r   z.UrlParseTestCase.test_RFC2732.<locals>._encodeg  s-    Q4;;w'1W)=qtCCr   )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.78r   )	r?   r@   rA   rK   rN   rO   r   assertRaises
ValueError)
rR   r   r   r   r   rS   rN   rO   	urlparsedinvalid_urls
             r[   test_RFC2732zUrlParseTestCase.test_RFC2732F  s    	@	D+459awqz95#,{#:C4--c2Ii00)..AXtDTU $;.	 3<<)Qqxx()<${2Kj&,,*?*?M 3 6 =s   C<Cc                    ddddddddt         d	d
ft        d	dfg
}d }|D cg c]
  } ||       }}||z   D ]  \  }}}t        j                  j	                  |      }| j                  |j                         |       | j                  |||f       | j                  |j                  |       | j                  |j                  |        y c c}w )N)zhttp://python.org#fraghttp://python.orgfrag)r>  r>  r   )zhttp://python.org/#fraghttp://python.org/r?  )r@  r@  r   )zhttp://python.org/?q#fraghttp://python.org/?qr?  )rA  rA  r   )zhttp://python.org/p#fragzhttp://python.org/pr?  )http://python.org/p?qrB  r   r   r   r   c                 2     t        |       d | D              S )Nc              3   >   K   | ]  }|j                  d         ywr   r   r   s     r[   r   zCUrlParseTestCase.test_urldefrag.<locals>._encode.<locals>.<genexpr>  s     8a188G,ar   )typer   s    r[   r   z0UrlParseTestCase.test_urldefrag.<locals>._encode  s    478a888r   )	r  r   r?   r@   	urldefragrK   rJ   rS   rH   )	rR   r   r   r   r   rS   defragr?  rW   s	            r[   test_urldefragzUrlParseTestCase.test_urldefragx  s    C:E<I@GB/5/4
		9+459awqz95!*[!8C\\++C0FV]]_c2Vfd^4VZZ0V__d3 "9 6s   Cc                 `   t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       y )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@   rP   rK   rN   rD   )rR   r   s     r[   test_urlsplit_scoped_IPv6z*UrlParseTestCase.test_urlsplit_scoped_IPv6  s    LL!!"PQ%EF#JKLL!!"QR%FG#KLr   c                    d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d        | j                  |j                  d        | j                  |j                  d       | j                  |j                  d        | j                  |j                         dd  |dd         d	}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d
       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                         |       d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                         |       d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d        | j                  |j                  d        | j                  |j                  d       | j                  |j                  d        | j                  |j                         dd  |dd         d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                         |       d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d        | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                         |       d!}t         j                  j                  |      }| j                  t        d"      5  |j                   d d d        y # 1 sw Y   y xY w)#NzHTTP://WWW.PYTHON.ORG/doc/#fragr   zWWW.PYTHON.ORG/doc/r   r?  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@   rP   rK   rC   rD   rE   rG   rH   rL   rM   rN   rO   rJ   assertRaisesRegexr9  )rR   rS   r   s      r[   test_urlsplit_attributesz)UrlParseTestCase.test_urlsplit_attributes  s   /LL!!#&6*#34)"%V,T*T*%56& 	ABQR1GLL!!#&6*#AB)+.V,V,V,%56$S) TLL!!#&6*#MN)+.V,%78V,%56$S) 1LL!!#&7+#45*#&W-T*T*%67&ABQR1HLL!!#&7+#BC*,/W-W-W-%67$S)TLL!!#&7+#NO*,/W-%89W-%67$S) 7LL!!#&##J?FF @??s   2__c                    d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d        | j                  |j                  d        | j                  |j                  d       | j                  |j                  d        | j                  |j                         d       d}t         j                  j                  |      }| j                  |j                  d	       | j                  |j
                  d
       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d        | j                  |j                  d        | j                  |j                  d
       | j                  |j                  d        | j                  |j                         d       d}d}t        d      D ]_  }t         j                  j                  ||      }| j                  |j                  d       | j                  |j                         d       a y )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   rW  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@   rP   rK   rC   rD   rE   rG   rH   rL   rM   rN   rO   rJ   range)rR   rS   r   rC   _s        r[   !test_urlsplit_remove_unsafe_bytesz2UrlParseTestCase.test_urlsplit_remove_unsafe_bytes  s4   kLL!!#&6*#34!<="34Z0T*T*%56&%no mLL!!#&7+#45!=>"45[1T*T*%67&%op fqA%%c&%9AQXXv.QXXZ)rs r   c                 	   t        t        dd            }d}|j                  d      |z   }t        j                  j                  |      }| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d	       | j                  |j                  d
       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j!                         |       ||j#                  d      z   }t        j                  j                  |      }| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j!                         |j#                  d             d}t        j                  j                  |j                  d      |z         }| j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j                  d       | j                  |j!                         |       t        j                  j                  d      }| j                  t        j                  j%                  |      d       d}|j                  d      dz   |j                  d      z   }t        d      D ]_  }t        j                  j                  ||      }| j                  |j                  d       | j                  |j!                         d       a y ) Nr   !   rN  utf-8r   rO  rL  rP  r?  rQ  rR  r   rS  r   rX  rU  rY  rV  rZ  r[  rW  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   r`  zhttps://www.python.org/)bytesra  decoder?   r@   rP   rK   rC   rD   rE   rG   rH   rL   rM   rN   rO   rJ   r   rQ   )rR   noisebase_urlrS   r   query_spaces_urlrC   rb  s           r[   test_urlsplit_strip_urlz(UrlParseTestCase.test_urlsplit_strip_url  s^   eAx()Lll7#h.LL!!#&6*#AB)+.V,V,V,%56$X.hoog..LL!!#&7+#BC*,/W-W-W-%67$X__W%=> GLL!!%,,w"7:J"JK7+#67),/$%56LL!!/2 	003_E "g&05<<3HHqA%%c&%9AQXXw/QXXZ)BC r   c           
      V   	 dD ]
  }t         j                  j                  t         j                  j                  fD ]  }dD ]  }| j	                  |||      5  d|z   }d|z   dz   }|rM|j                         r3|j                         r#|j                  d      }|j                  d      }n
	 d d d        t ||      }| j                  |j                  |       | j                  t              5  |j                   d d d        d d d           y # 1 sw Y   xY w# 1 sw Y   xY w)NFT)	r*  z1.5z-10x10z-01_1z 1z1 u   ६)rh  r@   rO   zwww.example.net:zhttp://r   r   )r?   r@   rP   rA   r   isasciir   rK   rD   r8  r9  rO   )rR   rh  r@   rO   rD   rS   r   s          r[   test_attributes_bad_portz)UrlParseTestCase.test_attributes_bad_portU  s    ."E ,,//1F1FGXDETJ!3d!:'&036 %~~/DLLN)/w)?&)jj&9 ( KJ "#J((6:!..z:FF ; KJ Y H # ;: KJs+   AD	59D	.D;D	DD	D(c           	         	 dD ]  }t         j                  j                  t         j                  j                  fD ]  }dD ]  }| j	                  |||      5  |dz   }|r,|j                         r|j                  d      }n
	 d d d        K ||      }|r| j                  |j                  d       n| j                  |j                  d       d d d           y # 1 sw Y   xY w)Nro  )r   +-0zhttp&u   ६http)rh  r@   rC   z://www.example.netr   r   r   )	r?   r@   rP   rA   r   rr  r   rK   rC   )rR   rh  r@   rC   rS   r   s         r[   test_attributes_bad_schemez+UrlParseTestCase.test_attributes_bad_schemeh  s    0"E ,,//1F1FGFFEvN$';; "{{}&)jj&9 ( ON "#J  ,,QXXs; ,,QXXr: ON G H # ONs   +C	AC	C&c                 d   d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                         |       t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                         |       d}t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                         |       t         j                  j                  |      }| j                  |j                  d       | j                  |j
                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                  d        | j                  |j                         |       y )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@   rP   rK   rD   rL   rM   rN   rO   rJ   rA   )rR   urir   s      r[   test_attributes_without_netlocz/UrlParseTestCase.test_attributes_without_netlocz  sJ    ALL!!#&2&T*T*T*&S)LL!!#&2&T*T*T*&S) BLL!!#&3'T*T*T*&S)LL!!#&3'T*T*T*&S)r   c                     | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       y )Nz http://example.com?blahblah=/foo)r   r   r   r   zblahblah=/foor   s    http://example.com?blahblah=/foo)r   s   example.comr   r   s   blahblah=/foor   r  r  s    r[   test_noslashzUrlParseTestCase.test_noslash  sJ    ../QRM	O../RSS	Ur   c                 8   | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d	      d
       | j                  t        j                  j                  d      d       y )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    r[   test_withoutschemez#UrlParseTestCase.test_withoutscheme  s    
 	..v6'	)../DE4	6../IJ8	: 	..w7-	/../EF:	<../JK>	@r   c                 l   | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d	      d
       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       y )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    r[   test_portseparatorz#UrlParseTestCase.test_portseparator  s   ..y9;TU..z:<VW..y9;TU..w78OP..x89QR../IJ8	: 	..z:<[\..{;=]^..z:<[\..x89VW..y9:XY../JK>	@r   c                 b    | j                  t        t        j                  j                  d       y )Nr*  )r8  	TypeErrorr?   r@   	urlencoder  s    r[   test_usingsyszUrlParseTestCase.test_usingsys  s    )V\\%;%;UCr   c                    | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d	      d
       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       | j                  t        j                  j                  d      d       y )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      queryr_  s!   x-newscheme://foo.com/stuff?query)r  r  r  r   r  r   r  r  s    r[   test_anyschemezUrlParseTestCase.test_anyscheme  s$   ../CD@	B../LMI	K../[\V	X../RSN	P 	../DEF	H../MNO	Q../\]\	^../STT	Vr   c                    t         j                  j                  t         j                  j                  fD ]:  }| j	                  |      5   |dd      }| j                  |j                  d        |dd      }| j                  |j                  d       | j                   |dd      j                  d       | j                   |dd	      j                  d       | j                   |d
d	      j                  d       | j                   |d      j                  d       | j                   |d
      j                  d       | j                   |d
d      j                  d       d d d        = y # 1 sw Y   IxY w)N)functionzhttp://example.net/ftpr   s   http://example.net/s   ftpr   rE   r`  r  r   r   )r?   r@   rA   rP   r   rK   rC   )rR   funcrW   s      r[   test_default_schemez$UrlParseTestCase.test_default_scheme  s-   \\**FLL,A,ABDt,3U;  74f=  8  fe!4!;!;UC  fU!;!B!BEJ  gf!=!D!DfM  f!4!4b9  g!5!5s;  gr!2!9!93? -, C,,s   DE44E>	c           
      J   d}|D ]  \  }}}t         j                  j                  t         j                  j                  fD ]O  }|dk(  r|t         j                  j                  u rd}| j	                  ||      5   ||d      }| j                  |j                  d       | j                  t        ||      j                  d|z                | j                   ||dd      j                  d        ||d	      }| j                  |j                  |       | j                  t        ||      j                  |             | j                   ||dd	      j                  |       | j                   ||      j                  |       d d d        R  y # 1 sw Y   axY w)
N)
)z
http:#fragrE   r?  )z//example.net#fragrE   r?  )zindex.html#fragrE   r?  )z	;a=b#fragrF   r?  )z	?a=b#fragrG   r?  )z#fragrE   r?  )z	abc#@fragrE   @frag)z//abc#@fragrE   r  )z//abc:80#@fragrE   r  )z//abc#@frag:80rE   z@frag:80rF   rE   )rS   r  F)allow_fragmentsr   #T)r?   r@   rA   rP   r   rK   rH   
assertTruegetattrendswithassertFalse)rR   testsrS   attrexpected_fragr  rW   s          r[   test_parse_fragmentsz%UrlParseTestCase.test_parse_fragments  se   
 ).$C}..0E0EF8#0E0E(E!D\\cD\9!#u=F$$V__b9OO#FD1::3;NOQ$$T#r5%9%B%BBG!#t<F$$V__mD$$#FD1::=IK$$T#r4%8%A%A%24$$T#Y%7%7G :9 G ). :9s   ;DFF"c                    | j                  t        d      5  t        j                  j	                  dd       d d d        | j                  t        d      5  t        j                  j	                  dd       d d d        | j                  t        d      5  t        j                  j                  dd       d d d        | j                  t        d      5  t        j                  j                  dd       d d d        | j                  t        d      5  t        j                  j                  d       d d d        | j                  t        d      5  t        j                  j                  d       d d d        | j                  t        d      5  t        j                  j                  d       d d d        | j                  t        d      5  t        j                  j                  d	       d d d        | j                  t        d      5  t        j                  j                  d
d       d d d        | j                  t        d      5  t        j                  j                  dd
       d d d        y # 1 sw Y   >xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   wxY w# 1 sw Y   FxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)NzCannot mix strr   r   rW  r   )r   r   r   r   r   r   )r   rW  r   r   r   r   )r   r   r   r   r   )r   rW  r   r   r   r>  s   http://python.org)	r\  r  r?   r@   rA   rP   rI   rQ   r   r  s    r[   test_mixed_types_rejectedz*UrlParseTestCase.test_mixed_types_rejected  s    ##I/?@LL!!"2G< A##I/?@LL!!"3V< A##I/?@LL!!"2G< A##I/?@LL!!"3V< A##I/?@LL##$LM A##I/?@LL##$KL A##I/?@LL##$HI A##I/?@LL##$HI A##I/?@LL  !46JK A##I/?@LL  !57JK A@% A@@@@@@@@@@@@@@@@@@@sw   !I4!J!J!J J( J5 K K!K
!K'4I>JJJ%(J25J?KKK$'K0c                    t        |j                        }|j                  }| j                  |j                  |       d|z  }d|z  } || } || }d}d}	| j                  ||       | j                  |j                         |       | j                  |j                         |       | j                  |j                  |      |       | j                  |j                  |      |       | j                  |j                  ||	      |       | j                  |j                  ||	      |       | j                  ||       | j                  |j                         |       | j                  |j                         |       | j                  |j                  |      |       | j                  |j                  |      |       | j                  |j                  ||	      |       | j                  |j                  ||	      |       y )N)r   )r   r   strict)rd   _fields_encoded_counterpartassertIs_decoded_counterpartrK   ri  r   )
rR   str_typenum_args
bytes_typestr_args
bytes_args
str_resultbytes_resultencodingerrorss
             r[   _check_result_typez#UrlParseTestCase._check_result_type0  s   x''(22
j55x@8#h&
x(
!:.X.,,.9,,.
;,,X6A,,X6
C,,Xv>I,,Xv>
Kz2**,j9**,l;**84jA**84lC**8V<jI**8V<lKr   c                     t         j                  j                  t         j                  j                  t         j                  j                  g}|D ]  }| j                  |        y r>   )r?   r@   DefragResultSplitResultParseResultr  )rR   result_typesresult_types      r[   test_result_pairsz"UrlParseTestCase.test_result_pairsI  sL     ,,
#
#
,,
"
"
,,
"
"

 (K##K0 (r   c                 "   t         j                  j                  dd      }| j                  |ddgi       t         j                  j                  dd      }| j                  |ddgi       t         j                  j                  dd      }| j                  |dd	gi       t         j                  j                  d
d      }| j                  |ddgi       t         j                  j                  d
dd      }| j                  |ddgi       y )N	   key=Ł%E9latin-1r  key   Łé   key=Ł%C3%A9rf  r      Ł��
   key=Ł%E9-   Ł�-ignorer  r     Ł-)r?   r@   rm   rK   rR   rW   s     r[   test_parse_qs_encodingz'UrlParseTestCase.test_parse_qs_encodingS  s   &&&K%,!89&&'9G&L%,!89&&'9G&L%*>)?!@A&&'7'&J%/):!;<&&'7'AI ' K%)!56r   c                    t         j                  j                  dd      }| j                  |dg       t         j                  j                  dd      }| j                  |dg       t         j                  j                  dd      }| j                  |dg       t         j                  j                  d	d      }| j                  |d
g       t         j                  j                  d	dd      }| j                  |dg       y )Nr  r  r  )r  r  r  rf  r   )r  r  r  )r  r  r  r  )r  r  )r?   r@   rc   rK   r  s     r[   test_parse_qsl_encodingz(UrlParseTestCase.test_parse_qsl_encoding`  s    '')'L"7!89''(:W'M"7!89''(:W'M"?!@A''(87'K":!;<''(87AI ( K"4!56r   c                 (   | j                  t              5  t        j                  j	                  dj                  dgdz        d       d d d        t        j                  j	                  dj                  dgdz        d       y # 1 sw Y   >xY w)Nr   za=a   
   )max_num_fields)r8  r9  r?   r@   rc   joinr  s    r[   test_parse_qsl_max_num_fieldsz.UrlParseTestCase.test_parse_qsl_max_num_fieldsm  sj    z*LL""388UGBJ#7"K +sxx
3BG +*s   5BB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 ]  \  }}| j                  d|d|      5  t        j                  j                  |d      }| j	                  ||d|z         t        j                  j                  |d      }| j	                  ||d|z         d d d         y # 1 sw Y   xY w)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`   )r   r?   r@   rm   rK   )rR   parse_qs_semicolon_casesrf   rg   rW   result_bytess         r[   test_parse_qs_separatorz(UrlParseTestCase.test_parse_qs_separatorr  s!   "I2JcC5\"5'89sCj)*2JBKtdVn%VHVH=>$t-.$
  5LD&
4(,vjIJ..ts.C  1Cd1JK%||44TT4J  v7ID7PQ	 KJ 5JJs   A/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 ]  \  }}| j                  d|d|      5  t        j                  j                  |d      }| j	                  ||d|z         t        j                  j                  |d      }| j	                  ||d|z         d d d         y # 1 sw Y   xY w)Nr  r  r,   r   r.   r   r   r  r   r   r  r  r0   r    r2   r$   r&   r  r(   r*   r  r  r  r`   )r   r?   r@   rc   rK   )rR   parse_qsl_semicolon_casesrf   rg   rW   r  s         r[   test_parse_qsl_separatorz)UrlParseTestCase.test_parse_qsl_separator  s	   "I2Jj\"\<89Z012JBK|n%nn=>,56%
! 6LD&
4(,vjIJ///D  1Cd1JK%||55dd5K  v7ID7PQ	 KJ 6JJs   
A/CC	c                 H   | j                  t        j                  j                  d      dg       | j                  t        j                  j                  t	        d            dg       | j                  t        j                  j                  t        d            dg       y )Nr   r    )rK   r?   r@   rc   	bytearray
memoryviewr  s    r[   test_parse_qsl_bytesz%UrlParseTestCase.test_parse_qsl_bytes  so    //7,H//	&0AB\NS//
60BCl^Tr   c           
         t        dd      }ddd ddg i t        d      fD ]c  }| j                  t        j                  j
                  |fi |g        | j                  t        t        j                  j
                  |d       e y )	NT)r_   strict_parsingr   r   r           ra   r  )dictr  rK   r?   r@   rc   r8  r9  )rR   kwargsr   s      r[   test_parse_qsl_false_valuez+UrlParseTestCase.test_parse_qsl_false_value  ss    TBS$3B
3?AV\\33A@@"Ej&,,*@*@!qQ @r   c                    | j                  t        t        j                  j                  t        d             | j                  t        t        j                  j                  t        d             | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  t                      dD ]A  }| j                  t              5  t        j                  j	                  d|       d d d        C | j                  t              5  t        j                  j	                  dd       d d d        | j                  t              5  t        j                  j	                  dd       d d d        y # 1 sw Y   xY w# 1 sw Y   UxY w# 1 sw Y   y xY w)Nr   ra   )r   r   Nr   ra   r  g      ?r   r     ¦   )r8  r  r?   r@   rc   listiterobjectr9  UnicodeEncodeErrorUnicodeDecodeError)rR   r  s     r[   test_parse_qsl_errorsz&UrlParseTestCase.test_parse_qsl_errors  s%   )V\\%;%;T&\J)V\\%;%;T&\J)V\\%;%;Q?)V\\%;%;VXF6I"":.&&u	&B /. 7 12LL""6V"< 312LL""5G"< 32	 /.2222s$   1"F2"F(1"F4F%	(F14F=c                     t         j                  j                  ddgddd      } G d d      }t         j                  j                  d |       id      }| j                  |d	       y )
Nra   r   )r   rM     r   Tc                       e Zd Zd Zy):UrlParseTestCase.test_urlencode_sequences.<locals>.Trivialc                      y)Ntrivial r  s    r[   __str__zBUrlParseTestCase.test_urlencode_sequences.<locals>.Trivial.__str__  s     r   N)__name__
__module____qualname__r  r  r   r[   Trivialr    s    !r   r	  r	   z	a=trivial)r?   r@   r  rK   )rR   rW   r	  s      r[   test_urlencode_sequencesz)UrlParseTestCase.test_urlencode_sequences  s\     ''q!f9(EtL	! 	! ''gi(8$?-r   c                    t         j                  j                  ddi      }| j                  |d       t         j                  j                  ddit         j                  j                        }| j                  |d       t         j                  j                  ddidt         j                  j                        }| j                  |d	       y )
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  rK   quoter  s     r[   test_urlencode_quote_viaz)UrlParseTestCase.test_urlencode_quote_via  s    ''l(;<0''.B(C28,,2D2D ( F!;<''.B(C-0FLL<N<N ( P!9:r   c                    | j                  t        t        j                  j                  d       t        j                  j	                  d      }| j                  |d       t        j                  j	                  d      }| j                  |d       t        j                  j	                  ddz        }| j                  |ddz         t        j                  j	                  d	d
z        }| j                  |dd
z         y )Nr*  s   archaeological arcanazarchaeological%20arcanar   r      Ai'  As   z/ i zz%01/%20)r8  r  r?   r@   quote_from_bytesrK   r  s     r[   test_quote_from_bytesz&UrlParseTestCase.test_quote_from_bytes  s    )V\\%B%BEJ../GH!:;..s3$..tF{;V,..z'/ABG!34r   c                     t         j                  j                  d      }| j                  |d       t         j                  j                  d      }| j                  |d       y )Nz	abc%20defs   abc defr   r   )r?   r@   unquote_to_bytesrK   r  s     r[   test_unquote_to_bytesz&UrlParseTestCase.test_unquote_to_bytes  sJ    ..{;,..r2%r   c                     | j                  t        t        j                  j                  dd       | j                  t        t        j                  j                  dd       y )Ns   foorf  r  r  )r  )r8  r  r?   r@   r  r  s    r[   test_quote_errorsz"UrlParseTestCase.test_quote_errors  sI    )V\\%7%7#* 	 	,)V\\%7%7Qr   c                    t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       y )Nztel:+31-641044153telz+31-641044153ztel:+31641044153z+31641044153)r?   r@   rP   rK   rC   rE   rA   )rR   p1p2s      r[   test_issue14072z UrlParseTestCase.test_issue14072  s    \\""#67E*/2\\""#56E*.1\\""#67E*/2\\""#56E*.1r   c                    | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d	       | j                  t        t        j                  j                  d
       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d       | j                  t        t        j                  j                  d        | j                  t        t        j                  j                  d!       | j                  t        t        j                  j                  d"       | j                  t        t        j                  j                  d#       | j                  t        t        j                  j                  d$       | j                  t        t        j                  j                  d%       | j                  t        t        j                  j                  d&       | j                  t        t        j                  j                  d'       | j                  t        t        j                  j                  d(       | j                  t        t        j                  j                  d)       | j                  t        t        j                  j                  d*       | j                  t        t        j                  j                  d+       y ),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)r8  r9  r?   r@   rP   r  s    r[   test_invalid_bracketed_hostsz-UrlParseTestCase.test_invalid_bracketed_hosts  s   *fll&;&;=ef*fll&;&;=lm*fll&;&;=bc*fll&;&;=_`*fll&;&;=^_*fll&;&;=_`*fll&;&;=[\*fll&;&;=tu*fll&;&;  >J  	K*fll&;&;=Z[*fll&;&;=WX*fll&;&;=WX*fll&;&;=XY*fll&;&;=XY*fll&;&;=XY*fll&;&;=XY*fll&;&;=TU*fll&;&;=TU*fll&;&;=UV*fll&;&;=UV*fll&;&;=UV*fll&;&;=UV*fll&;&;=VW*fll&;&;=VW*fll&;&;=WX*fll&;&;=WX*fll&;&;=WX*fll&;&;=WX*fll&;&;=UV*fll&;&;=VW*fll&;&;=VW*fll&;&;=\]*fll&;&;=\]*fll&;&;=OP*fll&;&;=OP*fll&;&;=PQ*fll&;&;=OP*fll&;&;=OP*fll&;&;=VW*fll&;&;=VW*fll&;&;=\]*fll&;&;=UV*fll&;&;=UVr   c                 &   t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       | j                  |j                  d        t         j                  j                  d      }| j                  |j                  d	       | j                  |j
                  d       | j                  |j                  d       y )
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@   rP   rK   rN   rL   rE   rO   r  )rR   r  r  p3s       r[   test_splitting_bracketed_hostsz/UrlParseTestCase.test_splitting_bracketed_hosts  s   \\""#KLh/f-'*$'\\""#YZ&ABf-'*bggt$\\""#jk&RSf-'*r   c                 `   d}t         j                  j                  d      }| j                  t        |      5  |j
                   d d d        t         j                  j                  d      }| j                  t        |      5  |j
                   d d d        y # 1 sw Y   TxY w# 1 sw Y   y xY w)Nz3Port could not be cast to integer value as 'oracle'z%http://Server=sde; Service=sde:oracle)r?   r@   rA   r\  r9  rO   rP   )rR   messager  r  s       r[   !test_port_casting_failure_messagez2UrlParseTestCase.test_port_casting_failure_message.  s    G\\""#JK##J8GG 9 \\""#JK##J8GG 98	 98 98s   BB$B!$B-c                    t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d	       | j                  |j                  d
       t         j                  j                  d      }| j                  |j                  d       | j                  |j
                  d       | j                  |j                  d       y )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   rK   rC   rE   rF   )rR   r  s     r[   test_telurl_paramsz#UrlParseTestCase.test_telurl_params8  sJ   \\""#GHE*'*$>?\\""#89E*"34B'\\""#GHE*&)$?@\\""#JKE**-$>?r   c                     t         j                  j                  t         j                  j                        }| j	                  dt        |             y )NQuoter)r?   r@   _Quoter_ALWAYS_SAFEassertInrepr)rR   quoters     r[   test_Quoter_reprz!UrlParseTestCase.test_Quoter_reprM  s2    %%fll&?&?@hV-r   c                 @    t         j                  j                          y r>   )r?   r@   clear_cacher  s    r[   "test_clear_cache_for_code_coveragez3UrlParseTestCase.test_clear_cache_for_code_coverageQ  s      "r   c                     	 | j                  t              5  t        j                  j                  }d d d        y # 1 sw Y   y xY wr>   )r8  AttributeErrorr?   r@   this_does_not_exist)rR   unuseds     r[   !test_urllib_parse_getattr_failurez2UrlParseTestCase.test_urllib_parse_getattr_failureT  s.    C~.\\55F /..s	   ;Ac                 D   g }h d}t        t        j                        D ]T  }|j                  d      s||v rt	        t        j                  |      }t	        |dd       dk(  sD|j                  |       V | j                  t        j                  j                  |       y )N>   unwrapsplittagto_bytes	splitattr	splithost	splitport	splittype	splituser
ResultBase
splitnport
splitquery
splitvaluer5  splitpasswdrb  r  zurllib.parse)dirr?   r@   
startswithr  appendassertCountEqual__all__)rR   r   undocumentednamer  s        r[   test_allzUrlParseTestCase.test_allY  s    
 %Ds#t|';V\\40Fv|T2nD% & 	fll22H=r   c                    d}|D ch c]  }dj                  t        |             }}t        t        t	        dt
        j                              D cg c]L  }t        j                  |      r5|t        t        j                  |      j                               z  r||vr|N }}| j                  d|       | j                  d|       t        j                  j                  d       | j                  t               5  t        j                  j                  d       d d d        dD ]  }d	D ]  }|D ]  }d
j                  ||j                  |            }| j#                  |dj                  t        |                  5  | j                  t               5  t        j                  j                  |       d d d        d d d           y c c}w c c}w # 1 sw Y   xY w# 1 sw Y   .xY w# 1 sw Y   xY w)Nz/:#?@z{:04X}   u   ℀u   ＃u   http://プ:80u   http://プ︓80)r   r   r  )znetloc{}false.netloczn{}user@netlocz{}://{}/path)rS   char)formatordmapchrra  sys
maxunicodeunicodedatadecompositionsetrU   r0  r?   r@   rP   r8  r9  r   )rR   illegal_charsr   	hex_charsdenorm_charsrC   rD   rS   s           r[   test_urlsplit_normalizationz,UrlParseTestCase.test_urlsplit_normalizationi  s     6CDmX__SV,m	D3c3>> :;
;!((+S!:!:1!=!C!C!EFF& ; 	 
 	h-h- 	67z*LL!!"?@ + /FD%A(//a8HIC#HOOCF4KL!..z:"LL11#6 ; ML & E /# E
 +* ;: MLs<   !GAG? GG1	 G%8G1	G"%G.*G1	1G:r>   ):r  r  r  r\   rj   rn   r   r   r   r   r   r  r  r!  r&  r,  r<  rH  rJ  r]  rc  rm  rs  rx  r{  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r  r  r  r   r%  r(  r+  r3  r6  r;  rQ  ra  r  r   r[   r<   r<   h   sA   38j77e9N?B$=LNS"A`@
%JZ7Br5&n0Nd4.M[z#tJ9Dv#&;$'*RU@&@$DV*@HBL0L2177H
R*R(U
R=.;	5&R
2+WZ+ @*.#6
> 7r   r<   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y)Utility_Testsc                 (   t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d	      d
       y )Nztype:opaquestring)rE  opaquestringre  )Nre  :opaquestring)Nrf  ztype:)rE  r   ztype:opaque:string)rE  zopaque:string)r?   r@   
_splittyperK   )rR   rC  s     r[   test_splittypezUtility_Tests.test_splittype  s    LL++	#679QR>24JK?35LM7+\:#78:STr   c                    t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d	      d
       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       y )Nz%//www.example.org:80/foo/bar/baz.html)www.example.org:80/foo/bar/baz.htmlz//www.example.org:80)rj  r   rk  )Nrk  z//127.0.0.1#@host.com)	127.0.0.1/#@host.comz//127.0.0.1#@host.com:80)rl  z/#@host.com:80z//127.0.0.1:80#@host.com)z127.0.0.1:80rm  z///file)r   z/filez//example.net/file;)example.netz/file;z//example.net/file?)rn  z/file?z//example.net/file#)rn  z/file#)r?   r@   
_splithostrK   )rR   rA  s     r[   test_splithostzUtility_Tests.test_splithost  s   LL++	#JKD	F#9:3	5#674	6 	#:;5	7#=>8	:#=>8	: 	9-&	( 	#892	4#892	4#892	4r   c                 (   t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d	      d
       y )NrO  )	User:Passwww.python.org:080z@www.python.org:080)r   rs  rs  )Nrs  z
User:Pass@)rr  r   rT  )zUser@example.com:Passrs  )r?   r@   
_splituserrK   )rR   rD  s     r[   test_splituserzUtility_Tests.test_splituser  s    LL++	#AB<	>#893	5#785	7<0*	,#MNH	Jr   c                    t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d	      d
       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       y )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 2rw  z
user+1:a+b)zuser+1za+bzuser:)r"  r   r"  )r"  Nz:ab)r   rw  )r?   r@   _splitpasswdrK   )rR   rI  s     r[   test_splitpasswdzUtility_Tests.test_splitpasswd  s+    ll//Y/@[13CD[13CD[13CD[13CD[13CDZ0/BZ0/B[13CD\24EFW-|<V,n=U+Z8r   c                    t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d	       | j                   |d
      d       | j                   |d      d       | j                   |d      d       y )N	parrot:88)parrot88r|  r|  Nparrot:rl  )rl  Nparrot:cheese)r  Nz[::1]:88)[::1]r}  r  )r  Nz:88)r   r}  )r?   r@   
_splitportrK   )rR   rB  s     r[   test_splitportzUtility_Tests.test_splitport  s    LL++	;/1AB8,.>?9-/?@;/1DE?35LM:.@7+_=5):6r   c                     t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |dd      d       | j                   |d      d       | j                   |dd      d       | j                   |d      d	       | j                   |dd      d
       | j                   |d      d       | j                   |dd      d       | j                   |d      d       y )Nr{  )r|  rg  r|  )r|  7   )r|  r  r  rl  )rl  r  )rl  r  r  r~  zparrot: +1_0 )r?   r@   _splitnportrK   )rR   rF  s     r[   test_splitnportzUtility_Tests.test_splitnport  s    \\--
K0.AH-~>Hb1>BI.?Ir2NCK02CDK46GHO46FGOR8:JKO46FGr   c                     t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       y )	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@   _splitqueryrK   )rR   rG  s     r[   test_splitqueryzUtility_Tests.test_splitquery  su     \\--
$DE>	@$EF?	A$<=9	;J/Ar   c                 (   t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d	      d
       y )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@   	_splittagrK   )rR   r>  s     r[   test_splittagzUtility_Tests.test_splittag  s    <<))"BC>	@"?@;	=&);7">?=	?"FGB	Dr   c                    t         j                  j                  }| j                   |d      dddgf       | j                   |d      ddgf       | j                   |d      dddgf       | j                   |d      dg f       y )Nz/path;attr1=value1;attr2=value2r#  zattr1=value1zattr2=value2z/path;r   z;attr1=value1;attr2=value2)r?   r@   
_splitattrrK   )rR   r@  s     r[   test_splitattrzUtility_Tests.test_splitattr  s    LL++	#DE!NN#CD	F8,wo>#?@~~>?	A7+gr];r   c                 (   t         j                  j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d	      d
       y )Nr  )r*  barzfoo=)r*  r   z=bar)r   r  foobar)r  Nzfoo=bar=baz)r*  zbar=baz)r?   r@   _splitvaluerK   )rR   rH  s     r[   test_splitvaluezUtility_Tests.test_splitvalue  s~     \\--
I.?F+[9F+[9H-/?@M24FGr   c                     t         j                  j                  d      }| j                  |d       | j	                  t
        t         j                  j                  d       y )Nzhttp://www.python.orgu   http://www.python.org/mediæval)r?   r@   	_to_bytesrK   r8  UnicodeErrorr  s     r[   test_to_byteszUtility_Tests.test_to_bytes  sH    ''(?@!89,(>(>?	Ar   c                 t    dD ]3  }t         j                  j                  |      }| j                  |d       5 y )N)z<URL:scheme://host/path>z<scheme://host/path>zURL:scheme://host/pathscheme://host/pathr  )r?   r@   r=  rK   )rR   wrapped_urlrS   s      r[   test_unwrapzUtility_Tests.test_unwrap  s5    LK,,%%k2CS"67Lr   N)r  r  r  rh  rp  ru  ry  r  r  r  r  r  r  r  r  r  r   r[   rc  rc    sH    GU4:J9$	7H
B
D<HA8r   rc  c                   T    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y)DeprecationTestc                 *   | j                  t              5 }t        j                  j                  }| j                  |t        j                  j                         d d d        | j                  dt        j                               y # 1 sw Y   /xY w)NzQuoter will be removed)
assertWarnsDeprecationWarningr?   r@   r-  r  r.  r0  strwarning)rR   cm	old_classs      r[   test_Quoter_deprecationz'DeprecationTest.test_Quoter_deprecation!  sa    01R++IMM)V\\%9%9: 2 	.BJJ@ 21s   AB		Bc                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zUurllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rC  rK   r  r  rR   r  s     r[   test_splittype_deprecationz*DeprecationTest.test_splittype_deprecation'  Q    01RLL""2& 2RZZ?	@ 21    A$$A-c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rA  rK   r  r  r  s     r[   test_splithost_deprecationz*DeprecationTest.test_splithost_deprecation.  r  r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rD  rK   r  r  r  s     r[   test_splituser_deprecationz*DeprecationTest.test_splituser_deprecation5  r  r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rI  rK   r  r  r  s     r[   test_splitpasswd_deprecationz,DeprecationTest.test_splitpasswd_deprecation<  sQ    01RLL$$R( 2RZZ?	@ 21r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rB  rK   r  r  r  s     r[   test_splitport_deprecationz*DeprecationTest.test_splitport_deprecationC  r  r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rF  rK   r  r  r  s     r[   test_splitnport_deprecationz+DeprecationTest.test_splitnport_deprecationJ  Q    01RLL##B' 2RZZ?	@ 21r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   rG  rK   r  r  r  s     r[   test_splitquery_deprecationz+DeprecationTest.test_splitquery_deprecationQ  r  r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   r>  rK   r  r  r  s     r[   test_splittag_deprecationz)DeprecationTest.test_splittag_deprecationX  sQ    01RLL!!"% 2RZZ?	@ 21r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() instead)r  r  r?   r@   r@  rK   r  r  r  s     r[   test_splitattr_deprecationz*DeprecationTest.test_splitattr_deprecation_  r  r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   zWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() instead)r  r  r?   r@   rH  rK   r  r  r  s     r[   test_splitvalue_deprecationz+DeprecationTest.test_splitvalue_deprecationf  sR    01RLL##B' 2RZZ@	A 21r  c                     | j                  t              5 }t        j                  j	                  d       d d d        | j                  t        j                        d       y # 1 sw Y   /xY w)Nr   z/urllib.parse.to_bytes() is deprecated as of 3.8)r  r  r?   r@   r?  rK   r  r  r  s     r[   test_to_bytes_deprecationz)DeprecationTest.test_to_bytes_deprecationm  sO    01RLL!!"% 2RZZJ	L 21r  N)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r[   r  r    sJ    A@@@@@@@@@ALr   r  __main__)rY  r[  unittesturllib.parser?   r  r   r%  r+  rb   rl   TestCaser<   rc  r  r  mainr  r   r[   <module>r     s   
   %##
)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1* sCj!"* 	"I*  
2J!*" BK#*$ 
C#<%*& S4&M'*( 
D3%=)** TC5M+*, vh -*. &4&!"/*0 tf-.1*2 D8*%&3*4 tdVn5*6 VHVH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]7x(( ]7~(U8H%% U8pRLh'' RLj zHMMO r   