+
    Bi                       R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIHt ^ RIHt ^ RIt^ RIt ^ RIt^ RIt^ RIt^ RIt]P.                  '       g   ]
P0                  ! R4      hR tR%R lt ! R R	]4      t ! R
 R]
P:                  4      t ! R R]
P:                  4      t ! R R]
P:                  4      t  ! R R]
P:                  ]4      t! ! R R]
P:                  4      t" ! R R]
P:                  4      t# ! R R]
P:                  ]4      t$ ! R R]
P:                  4      t% ! R R]
P:                  4      t& ! R R]
P:                  4      t' ! R R]
P:                  4      t( ! R  R!]
P:                  4      t) ! R" R#]
P:                  4      t*]+R$8X  d   ]
PX                  ! 4        R# R#   ] d    Rt EL~i ; i)&z;Regression tests for what was in Python 2's "urllib" moduleN)support)	os_helper)socket_helperztest requires gethostname()c                    \        \        V 4      4      R,          P                  4       p\        V4      ^8X  d
   RV,          pRV,           # )z!Escape char as RFC 2396 specifies:   NNz0%s%)hexordupperlen)charhex_reprs   & '/usr/lib/python3.14/test/test_urllib.py	hexescaper      s=    3t9~b!'')H
8}8#>    c                    aaa  ! V3R  lR\         P                  4      o ! VV3R lR\        P                  P                  4      oV Sn        S# )c                   R   <a  ] tR t^&t o ^tV3R ltR tRR ltRR ltR t	Rt
V tR# )	fakehttp.<locals>.FakeSocketc                   < VSn         R # N)buf)selfdataFakeHTTPConnections   &&r   sendall$fakehttp.<locals>.FakeSocket.sendall)   s    %)"r   c                8    V ;P                   ^,          un         V # )   )io_refs)r   argskwdss   &*,r   makefile%fakehttp.<locals>.FakeSocket.makefile,   s    LLALKr   Nc                h    V P                   '       d   R # \        P                  P                  W4      # r   )closedioBytesIOread)r   amts   &&r   r(   !fakehttp.<locals>.FakeSocket.read0   s!    {{{::??4--r   c                h    V P                   '       d   R # \        P                  P                  W4      # r$   )r%   r&   r'   readline)r   lengths   &&r   r,   %fakehttp.<locals>.FakeSocket.readline5   s#    {{{::&&t44r   c                    V ;P                   ^,          un         V P                   ^ 8X  d"   \        P                  P                  V 4       R# R# )r   N)r   r&   r'   closer   s   &r   r0   "fakehttp.<locals>.FakeSocket.close:   s3    LLAL||q 

  & !r    r   )__name__
__module____qualname____firstlineno__r   r   r!   r(   r,   r0   __static_attributes____classdictcell__)__classdict__r   s   @r   
FakeSocketr   &   s(     	*		.
	5
	' 	'r   r;   c                   V   <a  ] tR t^?t o RtV3R lt Z'       d
   R tRtV tR# RtV tR# )$fakehttp.<locals>.FakeHTTPConnectionNc                j   < S! V P                   4      V n        V P                  \        V 4      n        R # r   )fakedatasocktypefakesock)r   r;   s   &r   connect,fakehttp.<locals>.FakeHTTPConnection.connectD   s#    "4==1DI"&))DJr   c                    R # r   r3   r1   s   &r   r0   *fakehttp.<locals>.FakeHTTPConnection.closeM   s    r   )r@   )	r4   r5   r6   r7   r   rC   r0   r8   r9   )r:   r;   
mock_closes   @r   r   r=   ?   s'      	, :
  r   r   )r&   r'   httpclientHTTPConnectionr?   )r?   rG   r   r;   s   &f@@r   fakehttprK   %   s?    'RZZ '2 T[[77   #+r   c                   0   a  ] tR t^Tt o RR ltR tRtV tR# )FakeHTTPMixinc                    \        WR 7      p\        P                  P                  V n        V\        P                  n        R# )rG   N)rK   rH   rI   rJ   _connection_class)r   r?   rG   fake_http_classs   &&& r   rK   FakeHTTPMixin.fakehttpU   s*    "8C!%!;!;%4"r   c                D    V P                   \        P                  n        R # r   )rP   rH   rI   rJ   r1   s   &r   
unfakehttpFakeHTTPMixin.unfakehttpZ   s    %)%;%;"r   )rP   NF)r4   r5   r6   r7   rK   rT   r8   r9   r:   s   @r   rM   rM   T   s     5
< <r   rM   c                      a  ] tR t^^t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tRtV tR# )urlopen_FileTestszTest urlopen() opening a temporary file.

Try to test as much functionality as possible so as to cut down on reliance
on connecting to the Net for testing.

c                ,   \        R V P                  P                  ,          R4      V n        \	        \
        P                  R4      p VP                  V P                  4       VP                  4        \
        P                  V n	        \        P                  P                  \        P                  ! V P                  4      4      V n        \        P                   P#                  RV P                  ,          4      V n        R#   TP                  4        i ; i)ztest_urllib: %s
asciiwbfile:%sN)bytes	__class__r4   textopenr   TESTFNwriter0   pathnameurllibparsequoteosfsencodequoted_pathnamerequesturlopenreturned_obj)r   fs   & r   setUpurlopen_FileTests.setUpf   s    -0G0GG!#	!!4(	GGDIIGGI!((%||11"++dmm2LM"NN229t?S?S3ST GGIs   D Dc                    V P                   P                  4        \        P                  ! \        P
                  4       R# )zShut down the open objectN)rm   r0   rh   remover   rb   r1   s   &r   tearDownurlopen_FileTests.tearDowns   s&    !
		)""#r   c                P    R F  pV P                  V P                  V4       K!  	  R# )r(   N)	r(   r,   	readlinesfilenor0   infogeturlgetcode__iter__)assertHasAttrrm   r   attrs   & r   test_interface urlopen_FileTests.test_interfacex   s&    GDt00$7Gr   c                n    V P                  V P                  V P                  P                  4       4       R # r   )assertEqualr`   rm   r(   r1   s   &r   	test_readurlopen_FileTests.test_read~   s%    D$5$5$:$:$<=r   c                    V P                  V P                  V P                  P                  4       4       V P                  R V P                  P                  4       R4       R# )r   zKcalling readline() after exhausting the file did not return an empty stringN)r   r`   rm   r,   r1   s   &r   test_readlineurlopen_FileTests.test_readline   sK    D$5$5$>$>$@Ad//88:3	4r   c                    V P                   P                  4       pV P                  \        V4      ^R4       V P                  V^ ,          V P                  R4       R# )r   z.readlines() returned the wrong number of linesz"readlines() returned improper textN)rm   rv   r   r   r`   )r   
lines_lists   & r   test_readlines urlopen_FileTests.test_readlines   sM    &&002
Z!I	KA		=	?r   c                    V P                   P                  4       pV P                  V\        R 4       V P	                  \
        P                  ! V\        V P                  4      4      V P                  R4       R# )zfileno() did not return an intzTReading on the file descriptor returned by fileno() did not return the expected textN)	rm   rw   assertIsInstanceintr   rh   r(   r   r`   )r   file_nums   & r   test_filenourlopen_FileTests.test_fileno   sW    $$++-h-MN3tyy>:DII<	=r   c                :    V P                   P                  4        R # r   )rm   r0   r1   s   &r   
test_closeurlopen_FileTests.test_close   s     	!r   c                    V P                  V P                  P                  \        P                  P
                  4       R # r   )r   rm   headersemailmessageMessager1   s   &r   test_headersurlopen_FileTests.test_headers   s(    d//779N9NOr   c                t    V P                  V P                  P                  R V P                  ,           4       R# file:N)r   rm   urlrj   r1   s   &r   test_urlurlopen_FileTests.test_url   s)    **..$:N:N0NOr   c                P    V P                  V P                  P                  4       R # r   )assertIsNonerm   statusr1   s   &r   test_statusurlopen_FileTests.test_status   s    $++223r   c                    V P                  V P                  P                  4       \        P                  P
                  4       R # r   )r   rm   rx   r   r   r   r1   s   &r   	test_infourlopen_FileTests.test_info   s+    d//4468M8MNr   c                |    V P                  V P                  P                  4       R V P                  ,           4       R# r   )r   rm   ry   rj   r1   s   &r   test_geturlurlopen_FileTests.test_geturl   s,    **113Wt?S?S5STr   c                X    V P                  V P                  P                  4       4       R # r   )r   rm   rz   r1   s   &r   test_getcodeurlopen_FileTests.test_getcode   s    $++3356r   c                b    V P                    F  pV P                  WP                  4       K   	  R # r   )rm   r   r`   )r   lines   & r   	test_iterurlopen_FileTests.test_iter   s&     %%DT99- &r   c                    V P                  \        \        P                  P                  R V P
                  ,           4       R# )z./N)assertRaises
ValueErrorre   rk   rl   rd   r1   s   &r   test_relativelocalfile(urlopen_FileTests.test_relativelocalfile   s'    *V^^%;%;D4==<PQr   c                   R pV P                  \        P                  P                  4      ;_uu_ 4       p\        P                  P                  V4       RRR4       \        P                  R8X  d)   V P                  XP                  P                  R4       R# V P                  XP                  P                  R4       R#   + '       g   i     Lu; i)zfile://pythontest.net/foo/barNntz\\pythontest.net\foo\barz-file:// scheme is supported only on localhost)r   re   errorURLErrorrk   rl   rh   namer   	exceptionfilenamereason)r   r   es   &  r   test_remote_authority'urlopen_FileTests.test_remote_authority   s    -v||4455NN""3' 677d?Q[[113NOQ[[//1`a 65s    CC	)rd   rj   rm   r`   N)r4   r5   r6   r7   __doc__ro   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r8   r9   rW   s   @r   rY   rY   ^   sl     U$
8>4?="
PP4OU7.Rb br   rY   c                   D   a  ] tR t^t o R tR tR tR tR tR t	Rt
V tR# )	
ProxyTestsc                    V P                  \        P                  ! 4       4      V n        \	        \
        P                  4       F5  pR VP                  4       9   g   K  V P                  P                  V4       K7  	  R# )proxyN)	enterContextr   EnvironmentVarGuardenvlistrh   environlowerunset)r   ks   & r   ro   ProxyTests.setUp   sN    $$Y%B%B%DEbjj!A!'')#q! "r   c                   V P                   P                  R R4       \        P                  P	                  4       pV P                  RVR,          4       V P                   P                  R R4       V P                  \        P                  P                  R4      4       V P                  \        P                  P                  R4      4       V P                  \        P                  P                  R4      4       R# )NO_PROXY	localhostno0localhost, anotherdomain.com, newdomain.com:1234anotherdomain.comanotherdomain.com:8888newdomain.com:1234N)r   setre   rk   getproxies_environmentr   
assertTrueproxy_bypass_environmentr   proxiess   & r   +test_getproxies_environment_keep_no_proxies6ProxyTests.test_getproxies_environment_keep_no_proxies   s    Z-..779gdm4Z!ST??@STU??@XYZ??@TUVr   c                (    V P                   P                  R R4       \        P                  P	                  4       pV P                  RVR,          4       V P                   P                  RR4       \        P                  P	                  4       pV P                  RV4       V P                   P                  R4       V P                   P                  R 4       R#   T P                   P                  R4       T P                   P                  R 4       i ; i)
HTTP_PROXYhttp://somewhere:3128rH   REQUEST_METHODGETN)r   r   re   rk   r   r   assertNotInr   r   s   & r   test_proxy_cgi_ignore ProxyTests.test_proxy_cgi_ignore   s    		)HHLL'>?nn;;=G4gfoFHHLL)51nn;;=GVW-HHNN+,HHNN<( HHNN+,HHNN<(s   BC 8Dc                   \         P                  P                  pV P                  P	                  R R4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R	4      4       V P                  V! R
4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       R# )r   z8localhost, anotherdomain.com, newdomain.com:1234, .d.o.tr   	LocalHost	LOCALHOSTz
.localhostr   z.newdomain.com:1234z	foo.d.o.tzd.o.tr   z.anotherdomain.com:8888zwww.newdomain.com:1234prelocalhostnewdomain.comznewdomain.com:1235Nre   rk   r   r   r   r   assertFalser   bypasss   & r   (test_proxy_bypass_environment_host_match3ProxyTests.test_proxy_bypass_environment_host_match   s    88ZO	Q{+,{+,{+,|,-345456{+,w(78989:789/001 456r   c                   \         P                  P                  pV P                  P	                  R R4       V P                  V! R4      4       V P                  V! R4      4       V P                  P	                  R R4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       R# )r   *r   r   z*, anotherdomain.comr   Nr   r   s   & r   *test_proxy_bypass_environment_always_match5ProxyTests.test_proxy_bypass_environment_always_match   s    88Z%/0345Z!7823401 456r   c                    \         P                  P                  pV P                  P	                  R R4       V P                  V! R4      4       V P                  V! R4      4       V P                  V! R4      4       R# )r   r   z
localhost
zanotherdomain.com:8888
znewdomain.com:1234
N)re   rk   r   r   r   r   r   s   & r   %test_proxy_bypass_environment_newline0ProxyTests.test_proxy_bypass_environment_newline  sb    88ZG	I./ :;< 678r   )r   N)r4   r5   r6   r7   ro   r   r   r   r   r   r8   r9   rW   s   @r   r   r      s)     "	W
)7&79 9r   r   c                   2   a  ] tR tRt o R tR tR tRtV tR# )ProxyTests_withOrderedEnvi
  c                l    \         P                  V n        \        P                  ! 4       \         n        R # r   )rh   r   
_saved_envcollectionsOrderedDictr1   s   &r   ro   ProxyTests_withOrderedEnv.setUp  s    ** ,,.
r   c                0    V P                   \        n        R # r   )r   rh   r   r1   s   &r   rs   "ProxyTests_withOrderedEnv.tearDown  s    __
r   c                   R \         P                  R&   R\         P                  R&   V P                  \        P                  P                  R4      4       V P                  \        P                  P                  R4      4       R \         P                  R&   R\         P                  R&   \        P                  P                  4       pV P                  / V4       R\         P                  R&   R	\         P                  R&   V P                  \        P                  P                  R4      4       V P                  \        P                  P                  R
4      4       V P                  \        P                  P                  R4      4       V P                  \        P                  P                  R4      4       V P                  \        P                  P                  R4      4       R\         P                  R&   R\         P                  R&   \        P                  P                  4       pV P                  RVR,          4       R# ) no_proxyr   No_Proxy	arbitrary
http_proxyr   r   z%localhost, noproxy.com, my.proxy:1234zxyz.comznoproxy.com:5678zmy.proxy:1234zmy.proxyzhttp://somewhereelse:3128
Http_ProxyrH   N)	rh   r   r   re   rk   r   r   r   r   r   s   & r   ,test_getproxies_environment_prefer_lowercaseFProxyTests_withOrderedEnv.test_getproxies_environment_prefer_lowercase  s   !#

:!,

:@@MN@@MN#%

< #:

< ..779W%!H

:!*

:??LM??@RST??PQ@@LM@@MN#:

< #>

< ..7790'&/Br   )r   N)	r4   r5   r6   r7   ro   rs   r  r8   r9   rW   s   @r   r   r   
  s     /%C Cr   r   c                   @  a  ] tR tRt o RtR tR tR t]P                  ! ]
R4      R 4       t]P                  ! ]
R4      R 4       t]P                  ! ]
R4      R	 4       t]P                  ! ]
R4      R
 4       tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )urlopen_HttpTestsi.  z.Test urlopen() opening a fake http connection.c                   V P                  R V,           R,           4        \        P                  P                  R4      pV P	                  VP                  4       R4       V P	                  VP                  4       R4       V P	                  VP                  4       R4       V P	                  VP                  4       ^4       V P                  4        R#   T P                  4        i ; i)s   HTTP/s    200 OK

Hello!http://python.org/s   Hello!r   N)	rK   re   rk   rl   r   r,   ry   rz   rT   )r   verfps   && r   
check_readurlopen_HttpTests.check_read1  s    hn'??@	''(<=BR[[]I6R[[]C0RYY[*>?RZZ\3/OODOOs   BC C$c                    R pV P                  R4        \        P                  P                  V4      pV P	                  VP                  4       V4       V P                  4        R#   T P                  4        i ; i)z-http://docs.python.org/library/urllib.html#OK   HTTP/1.1 200 OK

Hello!N)rK   re   rk   rl   r   ry   rT   )r   r   r  s   &  r   test_url_fragment#urlopen_HttpTests.test_url_fragment<  sX    =67	'',BRYY[#.OODOOs   ?A& &A8c                    V P                  R 4        \        P                  P                  R4      pV P	                  VP
                  4       V P                  4        R#   T P                  4        i ; i)r  http://www.python.orgN)rK   re   rk   rl   r   
will_closerT   )r   resps   & r   test_willclose urlopen_HttpTests.test_willcloseF  sN    67	>>))*ABDOODOO,OODOOs   :A A1zssl module requiredc                   \        \        ^ ^!4      4      ^.,            F  p\        V4      pRV R2pV P                  R4        \	        V4      P                  RR4      p\        P                  P                  pV P                  VRV 24      ;_uu_ 4        \        P                  P                  RV 24       RRR4       V P                  VRV 24      ;_uu_ 4        \        P                  P                  R	V 24       RRR4       V P                  4        K  	  R#   + '       g   i     Ln; i  + '       g   i     L9; i  T P                  4        i ; i)
    z//localhost:7777/test/   HTTP/1.1 200 OK

Hello.\\\contain control.*http:Nhttps:r   rangechrrK   reprreplacerH   rI   
InvalidURLassertRaisesRegexre   rk   rl   rT   r   char_nor   schemeless_urlescaped_char_reprr.  s   &     r   (test_url_path_with_control_char_rejected:urlopen_HttpTests.test_url_path_with_control_char_rejectedN  s/   E!TN+tf44Gw<D4TF!<NMM:;" %)J$6$6tU$C!![[33
++"34E3F GI INN**U>2B+CDI ++"34E3F GI INN**VN3C+DEI !) 5I II I !=   AE#D9%E#D2ED/*E2E=EEc                ,   V P                  R 4       RpRV,           R,           p \        P                  P                  pV P	                  VR4      ;_uu_ 4        \
        P                  P                  RV 24       RRR4       V P	                  VR4      ;_uu_ 4        \
        P                  P                  RV 24       RRR4       V P                  4        R#   + '       g   i     Lg; i  + '       g   i     L5; i  T P                  4        i ; i)	r#  z:localhost:7777?a=1 HTTP/1.1
X-injected: header
TEST: 123//:8080/test/?test=az*contain control.*\\r.*(found at least . .)r'  Ncontain control.*\\nr(  	rK   rH   rI   r.  r/  re   rk   rl   rT   r   hostr2  r.  s   &   r   4test_url_path_with_newline_header_injection_rejectedFurlopen_HttpTests.test_url_path_with_newline_header_injection_rejectedf  s    67O';;	 //J''IK K&&~.>'?@K ''
4KLL&&/?'@A M OOK K ML OO;   4D #C<"D #C.D C+	&D .C>	9D Dc                   \        \        ^ ^!4      4      ^.,            F  p\        V4      pRV R2pV P                  R4        \	        V4      P                  RR4      p\        P                  P                  pV P                  VRV 24      ;_uu_ 4        \        P                  P                  RV 24       RRR4       V P                  VRV 24      ;_uu_ 4        \        P                  P                  R	V 24       RRR4       V P                  4        K  	  R#   + '       g   i     Ln; i  + '       g   i     L9; i  T P                  4        i ; i)
r!  z//localhostz/test/r#  r$  r%  r&  r'  Nr(  r)  r0  s   &     r   (test_url_host_with_control_char_rejected:urlopen_HttpTests.test_url_host_with_control_char_rejected{  s#   E!TN+tf44Gw<D*4&7NMM:;	"$(J$6$6tU$C!![[33
++"34E3F GI INN**U>2B+CDI ++J:KL]K^8_``NN**VN3C+DE a ! 5I I a` !r6  c                ,   V P                  R 4       RpRV,           R,           p \        P                  P                  pV P	                  VR4      ;_uu_ 4        \
        P                  P                  RV 24       RRR4       V P	                  VR4      ;_uu_ 4        \
        P                  P                  RV 24       RRR4       V P                  4        R#   + '       g   i     Lg; i  + '       g   i     L5; i  T P                  4        i ; i)	r#  zlocalhost
X-injected: header
r8  r9  zcontain control.*\\rr'  Nr:  r(  r;  r<  s   &   r   4test_url_host_with_newline_header_injection_rejectedFurlopen_HttpTests.test_url_host_with_newline_header_injection_rejected  s    674';;	//J''35 5&&~.>'?@5 ''
4KLL&&/?'@A M OO5 5 ML OOr@  c                (    V P                  R 4       R# )s   0.9Nr  r1   s   &r   test_read_0_9urlopen_HttpTests.test_read_0_9  s     	r   c                (    V P                  R 4       R# )s   1.0NrH  r1   s   &r   test_read_1_0urlopen_HttpTests.test_read_1_0      r   c                (    V P                  R 4       R# )s   1.1NrH  r1   s   &r   test_read_1_1urlopen_HttpTests.test_read_1_1  rN  r   c                   V P                  R RR7        V P                  \        P                  P                  4      ;_uu_ 4       p\        P
                  P                  R4       RRR4       XP                  P                  4        V P                  4        R#   + '       g   i     L<; i  T P                  4        i ; i)s   HTTP/1.1 401 Authentication Required
Date: Wed, 02 Jan 2008 03:03:54 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e
Connection: close
Content-Type: text/html; charset=iso-8859-1
TrO   r  N)
rK   r   re   r   	HTTPErrorrk   rl   r   r0   rT   )r   cms   & r   test_read_bogus!urlopen_HttpTests.test_read_bogus  s     
  	 		""6<<#9#9::b&&';< ;LL OO	 ;: OOs#   1B-  B&"B- B*	%B- -B?c                   V P                  R RR7        RpV P                  \        P                  P                  V4      ;_uu_ 4       p\        P
                  P                  R4       RRR4       XP                  P                  4        V P                  4        R#   + '       g   i     L<; i  T P                  4        i ; i)s   HTTP/1.1 302 Found
Date: Wed, 02 Jan 2008 03:03:54 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e
Location: file://guidocomputer.athome.com:/python/license
Connection: close
Content-Type: text/html; charset=iso-8859-1
TrO   zRedirection to url 'file:r  N)
rK   r/  re   r   rS  rk   rl   r   r0   rT   )r   msgrT  s   &  r   test_invalid_redirect'urlopen_HttpTests.test_invalid_redirect  s       	 		-C''(>(>DD&&';< ELL OO	 ED OOs#   4B0 	 B)"B0 B-	(B0 0Cc                   \        \        P                  P                  P                  4       F  pV P                  R RR7        V P                  \        P                  P                  4      ;_uu_ 4       p\        P                  P                  R4       RRR4       XP                  P                  4        V P                  4        K  	  R#   + '       g   i     L@; i  T P                  4        i ; i)s_   HTTP/1.1 302 Found
Location: file://guidocomputer.athome.com:/python/license
Connection: close
TrO   http://somethingN)r*  re   rk   HTTPRedirectHandlermax_redirectionsrK   r   r   rS  rl   r   r0   rT   )r   irT  s   &  r   test_redirect_limit_independent1urlopen_HttpTests.test_redirect_limit_independent  s     v~~99JJKAMM    "&&v||'='=>>"NN**+=> ?""$! L ?> !s$   1C!6 C"C!CC!!C3c                    V P                  R 4        V P                  \        \        P                  P
                  R4       V P                  4        R#   T P                  4        i ; i)r   r\  N)rK   r   OSErrorre   rk   rl   rT   r1   s   &r   test_empty_socket#urlopen_HttpTests.test_empty_socket  sG     	c	gv~~'='=?QROODOOs   /A A&c                r   V P                  \        P                  P                  4      ;_uu_ 4       p\        P                  P                  R 4       RRR4       V P                  XP                  P                  4       V P                  VP                  P                  4       R#   + '       g   i     L\; i)z/file://localhost/a/file/which/doesnot/exists.pyN)
r   re   r   r   rk   rl   r   r   r   r   r   r   s   & r   test_missing_localfile(urlopen_HttpTests.test_missing_localfile  sl    v||4455NN""#TU 6,,-**+ 65    B&&B6	c                "   \         P                  ! 4       w  r\        P                  P	                  VR R7      p\        P
                  P                  V4      pVP                  RR7      P                  4       p V P                  \        P                  P                  V4      4       \        P                  P                  V4      ;_uu_ 4       pV P                  V4       V P                  VP                  V4       RRR4       \        P                   ! V4       \        P"                  ! V4       V P%                  \        P                  P                  V4      4       V P'                  \        P(                  P*                  4      ;_uu_ 4        \        P                  P                  V4       RRR4       R#   + '       g   i     L; i  \        P                   ! T4       \        P"                  ! T4       i ; i  + '       g   i     R# ; i)T
add_schemer   )netlocN)tempfilemkstempre   rk   pathname2urlrf   urlsplit_replacery   r   rh   pathexistsrl   r   r   r0   unlinkr   r   r   r   )r   fdtmp_filetmp_file_canon_urlparsedtmp_fileurlfobjs   &      r   test_file_notexists%urlopen_HttpTests.test_file_notexists  sK   '')#^^88d8S&&'9:oo[o9@@B	 OOBGGNN845''44%  +=> 5 HHRLIIh12v||4455NN"";/ 65 54 HHRLIIh555s1   9AG .F9<G  G=9G		G .G:=H	c                v   R pV P                  \        P                  P                  4      ;_uu_ 4       p\        P                  P                  V4       RRR4       V P                  XP                  P                  4       V P                  VP                  P                  4       R#   + '       g   i     L\; i)zftp:///pathNr   re   r   r   rk   rl   r   r   r   r   r   )r   test_ftp_urlr   s   &  r   test_ftp_nohost!urlopen_HttpTests.test_ftp_nohost  sr    $v||4455NN""<0 6--.**+ 65s    B((B8	c                r   V P                  \        P                  P                  4      ;_uu_ 4       p\        P                  P                  R 4       RRR4       V P                  XP                  P                  4       V P                  VP                  P                  4       R#   + '       g   i     L\; i)z.ftp://localhost/a/file/which/doesnot/exists.pyNr  rg  s   & r   test_ftp_nonexisting&urlopen_HttpTests.test_ftp_nonexisting  sn    v||4455NN""#ST 6--.**+ 65rj  r3   N)r4   r5   r6   r7   r   r  r  r  unittest
skipUnlesssslr4  r>  rB  rE  rI  rL  rP  rU  rY  r`  rd  rh  r}  r  r  r8   r9   rW   s   @r   r  r  .  s     8	 34" 5". 34 5( 34" 5"  34 5 
  "",0",, ,r   r  c                   Z   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tRtV tR# )urlopen_DataTestsi  z"Test urlopen() opening a data URL.c                   V P                  \        P                  P                  4       R V n        RV n        RV n        RV n        RV n        V P                  \        P                  P                  V P                  4      4      V n        V P                  \        P                  P                  V P                  4      4      V n        V P                  \        P                  P                  V P                  4      4      V n        R# )u   test data URLs :;,%=& ö Ä sU   PNG

   IHDR         {@   sRGB    IDATc```? 
o/    IENDB`zZdata:text/plain;charset=UTF-8,test%20data%20URLs%20%3A%3B%2C%25%3D%26%20%C3%B6%20%C3%84%20zPdata:text/plain;charset=ISO-8859-1;base64,dGVzdCBkYXRhIFVSTHMgOjssJT0mIPYgxCA%3Dzdata:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAIAAAB7
QOjdAAAAAXNSR0IArs4c6QAAAA9JREFUCNdj%0AYGBg%2BP//PwAGAQL%2BCm8 vHgAAAABJRU5ErkJggg%3D%3D%0A%20N)
addCleanupre   rk   
urlcleanupr`   imagetext_urltext_url_base64	image_urlr   rl   text_url_resptext_url_base64_respimage_url_respr1   s   &r   ro   urlopen_DataTests.setUp  s    112 ;	F 	
( 	 	. 	
 "..NN""4==13$($5$5NN""4#7#78%:!"//0F0Ft~~0VWr   c                P    R F  pV P                  V P                  V4       K!  	  R# )r(   N)r(   r,   rv   r0   rx   ry   rz   r{   )r|   r  r}   s   & r   r    urlopen_DataTests.test_interface'  s&    GDt1148Gr   c                V   V P                  V P                  P                  4       \        P                  P
                  4       V P                  V P                  P                  4       P                  4       RR.4       V P                  V P                  P                  4       R,          \        \        V P                  4      4      4       \        P                  P                  R4      pV P                  VP                  4       P                  4       RR.4       VP!                  4        R# )
text/plainzcontent-lengthzdata:,N)r  r  )charsetz
ISO-8859-1)r  zUS-ASCII)r   r  rx   r   r   r   r   r  
get_paramsr  strr   r  re   rk   rl   r0   )r   rs   & r   r   urlopen_DataTests.test_info-  s    d005579N9NO22779DDF!:;	=,,1134DEDJJ 	"NN""8,,,.!89	;		r   c                >   V P                  V P                  P                  4       V P                  4       V P                  V P                  P                  4       V P
                  4       V P                  V P                  P                  4       V P                  4       R # r   )r   r  ry   r  r  r  r  r  r1   s   &r   r   urlopen_DataTests.test_geturl8  sp    ++224dmmD2299;  	",,335t~~Fr   c                    V P                  V P                  P                  4       P                  \	        V P                  P                  4       P                  4       4      R ,          4      V P                  4       R# r  N)r   r  r(   decodedictrx   r  r`   r1   s   &r   test_read_text urlopen_DataTests.test_read_text>  sZ    ++00299##((*5578CEFJii	Qr   c                    V P                  V P                  P                  4       P                  \	        V P                  P                  4       P                  4       4      R ,          4      V P                  4       R# r  )r   r  r(   r  r  rx   r  r`   r1   s   &r   test_read_text_base64'urlopen_DataTests.test_read_text_base64B  sY    22779@@**//1<<>?	JLII	r   c                n    V P                  V P                  P                  4       V P                  4       R # r   )r   r  r(   r  r1   s   &r   test_read_image!urlopen_DataTests.test_read_imageG  s%    ,,113TZZ@r   c                d    V P                  \        \        P                  P                  R 4       R# )zdata:text/plainNr   r   re   rk   rl   r1   s   &r   test_missing_comma$urlopen_DataTests.test_missing_commaJ  s    *V^^%;%;<MNr   c                d    V P                  \        \        P                  P                  R 4       R# )zdata:;base64,Cg=Nr  r1   s   &r   test_invalid_base64_data*urlopen_DataTests.test_invalid_base64_dataM  s    *V^^%;%;<NOr   )r  r  r  r`   r  r  r  r  N)r4   r5   r6   r7   r   ro   r   r   r   r  r  r  r  r  r8   r9   rW   s   @r   r  r    sB     ,X@9	GQ
AOP Pr   r  c                   j   a  ] tR tRt o RtR tR tR tRR ltR t	R t
R	 tR
 tR tR tR tRtV tR# )urlretrieve_FileTestsiR  z(Test urllib.urlretrieve() on local filesc                   V P                  \        P                  P                  4       . V n        V P                  \        P                  4       R V n         \        \        P                  R4      pVP                  V P                  4       VP                  4        VP                  4        R#     R# ; i  XP                  4        i     i ; i; i)s   testing urllib.urlretriever\   N)r  re   rk   r  	tempFilesregisterFileForCleanUpr   rb   r`   ra   rc   r0   )r   FILEs   & r   ro   urlretrieve_FileTests.setUpU  s    112  	##I$4$451			(($/DJJtyy!JJLD Ds1   AB7 B/ /B47C8C	C	CCc                h    V P                    F  p\        P                  ! V4       K  	  R #     K$  ; ir   )r  rh   rr   )r   eachs   & r   rs   urlretrieve_FileTests.tearDownm  s"    NND4 #Ds   ,1c                    \         P                  P                  V4      p\        P                  P                  VR R7      # )Trl  )rh   rt  abspathre   rk   rq  )r   filePaths   &&r   constructLocalFileUrl+urlretrieve_FileTests.constructLocalFileUrls  s.    77??8,~~**8*EEr   c                0   \         P                  ! 4       w  r# V P                  V4       \        P                  ! VR4      pVP                  V4       VP                  4        VP                  4        V#     T# ; i  XP                  4        i     i ; i; i)zCreates a new temporary file containing the specified data,
registers the file for deletion during the test fixture tear down, and
returns the absolute path of the file.r\   )ro  rp  r  rh   fdopenrc   r0   )r   r   newFdnewFilePathnewFiles   &&   r   createNewTempFile'urlretrieve_FileTests.createNewTempFilew  s}    
 &--/	''4iit,GMM$MMO D Ds0   A	A< "A4 4A9<B=BBBBc                <    V P                   P                  V4       R # r   )r  append)r   fileNames   &&r   r  ,urlretrieve_FileTests.registerFileForCleanUp  s    h'r   c                    \         P                  P                  R \        P                  ,          4      pV P                  V^ ,          \        P                  4       V P                  V^,          \        P                  P                  R4       R# )r]   zFdid not get an email.message.Message instance as second returned valueN)
re   rk   urlretriever   rb   r   r   r   r   r   )r   results   & r   
test_basic urlretrieve_FileTests.test_basic  sb     ++I	8H8H,HII$4$45fQi)>)>9	:r   c                V   R \         P                  ,          pV P                  V4       \        P                  P                  V P                  \         P                  4      V4      pV P                  W^ ,          4       V P                  \        P                  P                  V4      R4       \        VR4      p VP                  4       pVP                  4        VP                  4        T P                  T P                  T4       R#     L"; i  TP                  4        i     i ; i; i)%s.2zcopy of the file was not maderbN)r   rb   r  re   rk   r  r  r   r   rh   rt  ru  ra   r(   r0   r`   )r   second_tempr  r  r`   s   &    r   	test_copyurlretrieve_FileTests.test_copy  s    y///##K0++D,F,F-*,Qi0{3 69 	:K&	99;DJJLD) D Ds0   : D D DD(D! D(!D%#D(c                   a  ^ .3V 3R llpR\         P                  ,          pS P                  V4       \        P                  P                  S P                  \         P                  4      W!4       R# )r!  c                    < SP                  V \        4       SP                  V\        4       SP                  V\        4       SP                  W^ ,          4       V^ ,          ^,           V^ &   R# )r!  N)r   r   r   )block_countblock_read_size	file_sizecount_holderr   s   &&&&r   
hooktester9urlretrieve_FileTests.test_reporthook.<locals>.hooktester  sW    !!+s3!!/37!!)S1[q/:*1o1LOr   r  N)r   rb   r  re   rk   r  r  )r   r  r  s   f  r   test_reporthook%urlretrieve_FileTests.test_reporthook  sV    NOS 	2 y///##K0""&&y'7'78	%r   c                (   . pV3R  lpV P                  4       p\        P                  P                  V P	                  V4      \
        P                  V4       V P                  \        V4      ^4       V P                  V^ ,          ^,          ^ 4       R# )c                 ,    VP                  WV34       R # r   r  r  r  r  _reports   &&&&r   r  Aurlretrieve_FileTests.test_reporthook_0_bytes.<locals>.hooktester      NNK)DEr   N	r  re   rk   r  r  r   rb   r   r   r   reportr  srcFileNames   &   r   test_reporthook_0_bytes-urlretrieve_FileTests.test_reporthook_0_bytes  st    HN 	F,,.""4#=#=k#Jj	*Va(1q)r   c                j   . pV3R  lpV P                  R4      p\        P                  P                  V P	                  V4      \
        P                  V4       V P                  \        V4      ^4       V P                  V^ ,          ^,          ^4       V P                  V^,          ^,          ^4       R# )c                 ,    VP                  WV34       R # r   r  r  s   &&&&r   r  Aurlretrieve_FileTests.test_reporthook_5_bytes.<locals>.hooktester  r  r   Ns   xxxxxr  r  s   &   r   test_reporthook_5_bytes-urlretrieve_FileTests.test_reporthook_5_bytes  s     HN 	F,,X6""4#=#=k#Jj	*Va(1q)1q)r   c                   . pV3R  lpV P                  RR,          4      p\        P                  P                  V P	                  V4      \
        P                  V4       V P                  \        V4      ^4       V P                  V^ ,          ^,          R4       V P                  V^ ,          ^,          R4       V P                  V^,          ^,          R4       V P                  V^,          ^,          R4       R# )c                 ,    VP                  WV34       R # r   r  r  s   &&&&r   r  Durlretrieve_FileTests.test_reporthook_8193_bytes.<locals>.hooktester  r  r      xi   i    Nr  r  s   &   r   test_reporthook_8193_bytes0urlretrieve_FileTests.test_reporthook_8193_bytes  s     HN 	F,,TD[9""4#=#=k#Jj	*Va(1t,1t,1t,1t,r   )r  r`   Nr$   )r4   r5   r6   r7   r   ro   rs   r  r  r  r  r  r  r  r  r  r8   r9   rW   s   @r   r  r  R  sE     20F (:*$%	**- -r   r  c                   0   a  ] tR tRt o RtR tR tRtV tR# )urlretrieve_HttpTestsi  z5Test urllib.urlretrieve() using fake http connectionsc                   V P                  \        P                  P                  4       V P	                  R 4       R pV P                  \        P                  P                  4      ;_uu_ 4         \        P                  P                  \        P                  VR7       V P                  4         RRR4       R#   T P                  4        i ; i  + '       g   i     R# ; i)   HTTP/1.1 200 OK
Date: Wed, 02 Jan 2008 03:03:54 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_ssl/2.8.22 OpenSSL/0.9.7e
Connection: close
Content-Length: 100
Content-Type: text/html; charset=iso-8859-1

FF
c                     R # r   r3   )par1par2par3s   &&&r   _reporthookYurlretrieve_HttpTests.test_short_content_raises_ContentTooShortError.<locals>._reporthook  s    r   )
reporthookNr  re   rk   r  rK   r   r   ContentTooShortErrorr  r   TEST_HTTP_URLrT   )r   r  s   & r   .test_short_content_raises_ContentTooShortErrorDurlretrieve_HttpTests.test_short_content_raises_ContentTooShortError  s    112  		 v||@@AA"**7+@+@6A + C ! BA
 ! BAAs$   /C1/B; C;CCC!	c                   V P                  \        P                  P                  4       V P	                  R 4       V P                  \        P                  P                  4      ;_uu_ 4         \        P                  P                  \        P                  4       V P                  4         RRR4       R#   T P                  4        i ; i  + '       g   i     R# ; i)r  Nr  r1   s   &r   Atest_short_content_raises_ContentTooShortError_without_reporthookWurlretrieve_HttpTests.test_short_content_raises_ContentTooShortError_without_reporthook  s    112  	 v||@@AA"**7+@+@A!	 BA !	 BAAs$   ,C.-B6C6CCC	r3   N)	r4   r5   r6   r7   r   r
  r  r8   r9   rW   s   @r   r  r    s     ?"." "r   r  c                   Z   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tRtV tR# )QuotingTestsi
  a)  Tests for urllib.quote() and urllib.quote_plus()

According to RFC 3986 (Uniform Resource Identifiers), to escape a
character you write it as '%' + <2 character US-ASCII hex value>.
The Python code of ``'%' + hex(ord(<character>))[2:]`` escapes a
character properly. Case does not matter on the hex letters.

The various character sets specified are:

Reserved characters : ";/?:@&=+$,"
    Have special meaning in URIs and must be escaped if not being used for
    their special meaning
Data characters : letters, digits, and "-_.!~*'()"
    Unreserved and do not need to be escaped; can be, though, if desired
Control characters : 0x00 - 0x1F, 0x7F
    Have no use in URIs so must be escaped
space : 0x20
    Must be escaped
Delimiters : '<>#%"'
    Must be escaped
Unwise : "{}|\^[]`"
    Must be escaped

c                   R P                  . RO4      p\        P                  P                  V4      pV P	                  WRV: RV: 24       \        P                  P                  V4      pV P	                  WRV: RV: 24       R# )r  using quote():  != using quote_plus(): N)ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
0123456789z_.-~)joinre   rf   rg   r   
quote_plus)r   do_not_quoter  s   &  r   test_never_quoteQuotingTests.test_never_quote$  su    xx !) * ##L1v6BFK	M((6v:FO	Qr   c                |    V P                  \        P                  P                  P                  ^ ,          R4       R# )r!  r"  N)r   re   rf   rg   __defaults__r1   s   &r   test_default_safeQuotingTests.test_default_safe1  s'    ++88;SAr   c                   R p\         P                  P                  WR7      pV P                  WRV: RV: 24       \         P                  P	                  VVR7      pV P                  WRV: RV: 24       \         P                  P                  VRR7      pV P                  WRV: RV: 24       \         P                  P                  RRRR	7      p\         P                  P                  RRR
R	7      pV P                  W2RV: RV: 24       \         P                  P                  RRRR	7      p\         P                  P                  RRR
R	7      pV P                  W2RV: RV: 24       R# )z<>safer  r  r  s   <>u   aüblatin-1   ü)encodingr#  r     N)re   rf   rg   r   r  )r   quote_by_defaultr  expects   &   r   	test_safeQuotingTests.test_safe5  sY   ##$4#L)66FO	Q(()9.> ) @)6*F4	5 ##$45#A)66FO	Q ##Hyv#N##Hyr#J &*	+ ##Hyw#O##Hyr#J &*	+r   c                   \        ^ 4       Uu. uF  p\        V4      NK  	  ppVP                  R4       VP                  \        ^4      4       RP                  V4      pV F  p\        P
                  P                  V4      pV P                  \        V4      VRV: R\        V4      : RV: 24       \        P
                  P                  V4      pV P                  \        V4      VRV: R\        V4      : RV: 24       K  	  ?RpR	p\        P
                  P                  V4      pV P                  WdRV: R
V: 24       \        P
                  P                  V4      pV P                  WdRV: R
V: 24       R# u upi )    z<>#%"{}|\^[]`r  r  z should be escaped to z, not r  z should be escapes to zab[]cdz
ab%5B%5Dcdr  N)
r*  r+  r  r  re   rf   rg   r   r   r  )r   numshould_quoter   r  partial_quoteexpecteds   &      r   test_default_quoting!QuotingTests.test_default_quotingR  sE    -2"I6ISCI6,-CH%ww|, D\\''-FYt_f #IdOV=> \\,,T2FYt_f #IdOV=> !  ##M266>G	I((76;CVL	N- 7s   Fc           
     R   \         P                  P                  R 4      pV P                  V\	        R 4      RV: R\	        R 4      : 24       \         P                  P                  R 4      pV P                  VRRV,          4       RpVP                  R \	        R 4      4      p\         P                  P                  V4      pV P                  W1RV: RV: 24       VP                  R R4      p\         P                  P                  V4      pV P                  W1RV: RV: 24       R# ) r  r  +zusing quote_plus(): %r != +z
a b cd e fr  N)re   rf   rg   r   r   r  r-  )r   r  givenr)  s   &   r   test_quoting_spaceQuotingTests.test_quoting_spacen  s     ##C(36<inM	O((-6?	AsIcN3##E*6<fE	GsC(((/;A6J	Lr   c                   V P                  \        P                  P                  R 4      R4       V P                  \        P                  P                  R R4      R4       V P                  \        P                  P                  R4      R4       V P                  \        P                  P                  R R4      R4       R# )zalpha+beta gammazalpha%2Bbeta+gammar6  zalpha+beta+gammas   alpha+beta gamma   +N)r   re   rf   r  r1   s   &r   test_quoting_plusQuotingTests.test_quoting_plus  s    001CD-	/001CSI+	- 	001DE-	/ 	001CTJ+	-r   c                T   R pRp\         P                  P                  V4      pV P                  W#RV: RV: 24       V P	                  \
        \         P                  P                  VRR7       \         P                  P                  V4      pV P                  W#RV: RV: 24       R# )   ab%A2%D8ab%FFr  r  r$  r&  zusing quote_from_bytes(): N)re   rf   rg   r   r   	TypeErrorquote_from_bytesr   r7  r)  r  s   &   r   test_quote_bytesQuotingTests.test_quote_bytes  s    !##E*6<fE	G 	)V\\%7%7%. 	 	0 ..u5"F,	-r   c                V   R pRp\         P                  P                  V4      pV P                  W#RV: RV: 24       \         P                  P                  VRRR7      pV P                  W#RV: RV: 24       R pRp\         P                  P                  VRR7      pV P                  W#RV: RV: 24       R	pR
p\         P                  P                  V4      pV P                  W#RV: RV: 24       R	pV P	                  \
        \         P                  P                  VRR7       R	pRp\         P                  P                  VRRR7      pV P                  W#RV: RV: 24       R	pRp\         P                  P                  VRRR7      pV P                  W#RV: RV: 24       R# )u   ¢Øabÿz%C2%A2%C3%98ab%C3%BFr  r  Nr&  errorsr@  r$  rA     漢字%E6%BC%A2%E5%AD%97z%3F%3Fr-  z%26%2328450%3B%26%2323383%3Bxmlcharrefreplace)re   rf   rg   r   r   UnicodeEncodeErrorrD  s   &   r   test_quote_with_unicode$QuotingTests.test_quote_with_unicode  s    '##E*6<fE	G ##ED#F6<fE	G !##EI#>6<fE	G %##E*6<fE	G ,fll.@.@%-6 	 	8 ##EI+4 $ 66<fE	G /##EI+> $ @6<fE	Gr   c                   R pRp\         P                  P                  VRR7      pV P                  W#RV: RV: 24       RpRp\         P                  P                  VRRR	7      pV P                  W#RV: RV: 24       R
# )u   ¢Ø ÿz
%A2%D8+%FFr$  rA  r  r  u   ab漢字 cdzab%3F%3F+cdr-  rH  N)re   rf   r  r   rD  s   &   r   test_quote_plus_with_unicode)QuotingTests.test_quote_plus_with_unicode  s    (((C;A6J	L $((09 ) ;;A6J	Lr   r3   N)r4   r5   r6   r7   r   r  r  r*  r2  r8  r<  rE  rN  rQ  r8   r9   rW   s   @r   r  r  
  sD     2QB+:N8L&
-- (GTL Lr   r  c                   Z   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tRtV tR# )UnquotingTestsi  zoTests for unquote() and unquote_plus()

See the doc string for quoting_Tests for details on quoting and such.

c           	     &   . p\        ^4       F  p\        \        V4      4      p\        V4      p\        P                  P                  V4      pV P                  WERV: RV: 24       \        P                  P                  V4      pV P                  WERV: RV: 24       VP                  V4       K  	  RP                  V4      p?\        P                  P                  V4      pV P                  VP                  R4      ^RV,          4       R# )   using unquote(): r  using unquote_plus(): r  r   z/using unquote(): not all characters escaped: %sN)r*  r   r+  re   rf   unquoter   unquote_plusr  r  count)r   escape_listr.  r7  r)  r  escape_strings   &      r   test_unquotingUnquotingTests.test_unquoting  s    :Cc#h'EXF\\))%0FVV<BFKM\\..u5FVV$f./ u%  ,%%m4c*A &'	(r   c                    V P                  \        \        3\        P                  P
                  R 4       V P                  \        \        3\        P                  P
                  R4       R # )Nr3   )r   rB  AttributeErrorre   rf   rY  r1   s   &r   #test_unquote_rejects_none_and_tuple2UnquotingTests.test_unquote_rejects_none_and_tuple  sD    9n5v||7K7KTR9n5v||7K7KRPr   c                   R pTp\         P                  P                  V4      pV P                  W#RV: RV: 24       RpTp\         P                  P                  V4      pV P                  W#RV: RV: 24       RpTp\         P                  P                  V4      pV P                  W#RV: RV: 24       R p\	        VR4      p\         P                  P                  V4      pV P                  W#RV: RV: 24       Rp\	        VR4      p\         P                  P                  V4      pV P                  W#RV: RV: 24       Rp\	        VR4      p\         P                  P                  V4      pV P                  W#RV: RV: 24       V P                  \        \        3\         P                  P
                  R4       V P                  \        \        3\         P                  P
                  R4       R# )	z%xabrW  r  z%xr   r[   using unquote_to_bytes(): Nr3   )	re   rf   rY  r   r^   unquote_to_bytesr   rB  ra  rD  s   &   r   test_unquoting_badpercent(UnquotingTests.test_unquoting_badpercent  s   %%e,"F*, 	-%%e,"F*, 	-%%e,"F*, 	- ug&..u5"F*, 	-ug&..u5"F*, 	-ug&..u5"F*, 	-9n5v||7T7TVZ[9n5v||7T7TVXYr   c                    R pRp\         P                  P                  V4      pV P                  W#RV: RV: 24       R# )z%Ab%eAs   re  r  Nre   rf   rf  r   rD  s   &   r   test_unquoting_mixed_case(UnquotingTests.test_unquoting_mixed_case  s<    ..u5"F,	-r   c                   R \        R4      ,          pRp\        P                  P                  V4      pV P	                  W#RV: RV: 24       \        P                  P                  V4      pV P	                  W#RV: RV: 24       R# )zab%sdcabcdr  r  rX  N)r   re   rf   rY  r   rZ  rD  s   &   r   test_unquoting_parts#UnquotingTests.test_unquoting_parts$  su     )C.(%%e,6<fE	G**51=CVL	Nr   c                   R pTp\         P                  P                  V4      pV P                  W#RV: RV: 24       VP	                  RR4      p\         P                  P                  V4      pV P                  W#RV: RV: 24       R# )zare+there+spaces...rW  r  r6  r5  rX  N)re   rf   rY  r   r-  rZ  rD  s   &   r   test_unquoting_plus"UnquotingTests.test_unquoting_plus0  sz    %%%e,8>G	IsC(**51=CVL	Nr   c                   R pRp\         P                  P                  V4      pV P                  W#RV: RV: 24       \         P                  P                  R4      pRpV P                  W#RV: RV: 24       RpRp\         P                  P                  V4      pV P                  W#RV: RV: 24       RpRp\         P                  P                  V4      pV P                  W#RV: RV: 24       R	# )
"br%C3%BCckner_sapporo_20050930.docs   brückner_sapporo_20050930.docre  r  	   漢%C3%BCs   漢üs   %A2%D8ab%FFr?  s	   %A2ab%FFNrj  rD  s   &   r   test_unquote_to_bytes$UnquotingTests.test_unquote_to_bytes<  s    48..u5"F,	- ..~>("F,	- "..u5"F,	-
  "..u5"F,	-r   c                J   R pRp\         P                  P                  V4      pV P                  W#RV: RV: 24       \         P                  P                  VRRR7      pV P                  W#RV: RV: 24       \         P                  P                  RRR7      pRpV P                  W#RV: RV: 24       R	pR
p\         P                  P                  V4      pV P                  W#RV: RV: 24       RpRp\         P                  P                  V4      pV P                  W#RV: RV: 24       \         P                  P                  VRR7      pV P                  W#RV: RV: 24       RpRp\         P                  P                  VRR7      pV P                  W#RV: RV: 24       \         P                  P                  R4      pRpV P                  W#RV: RV: 24       \         P                  P                  RRR7      pRpV P                  W#RV: RV: 24       R# )rv  u   brückner_sapporo_20050930.docrW  r  NrH  zbr%FCckner_sapporo_20050930.docr$  rA  rK  rJ  z%F3%B1u   �r-  )rI  r  ignorerw  u   漢üu   漢%FCre   rf   rY  r   rD  s   &   r   test_unquote_with_unicode(UnquotingTests.test_unquote_with_unicode[  s   45%%e,8>G	I %%ed4%H8>G	I %%&G/8 & :58>G	I %%%e,8>G	I %%e,8>G	I %%eI%>8>G	I %%eH%=8>G	I %%n58>G	I
 %%kI%F8>G	Ir   c                t   R pRp\         P                  P                  V4      pV P                  W#RV: RV: 24       RpRp\         P                  P                  V4      pV P                  W#RV: RV: 24       RpRp\         P                  P                  V4      pV P                  W#RV: RV: 24       R# )	s   blueberryjamblueberryjamrW  r  s   blåbærsyltetøyu   blåbærsyltetøys   bl%c3%a5b%c3%a6rsyltet%c3%b8ju   blåbærsyltetøjNr|  rD  s   &   r   test_unquoting_with_bytes_input.UnquotingTests.test_unquoting_with_bytes_input  s    %%e,8>G	I 70%%e,8>G	I 10%%e,8>G	Ir   r3   N)r4   r5   r6   r7   r   r^  rb  rg  rk  rp  rs  rx  r}  r  r8   r9   rW   s   @r   rT  rT    sE     (*Q"ZH-
N
N->8ItI Ir   rT  c                   l   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tRtV tR# )urlencode_Testsi  zTests for urlencode()c                L   . R
Op\         P                  P                  V4      pV F!  pV P                  WTRV: RV: RV: 24       K#  	  V P	                  VP                  R4      ^RV: RVP                  R4      : 24       VP                  R4      pWF^,
          ,          pWF^,           ,          pT P                  VP                  4       ;'       d    VP                  4       RV: RV: 24       V P	                  \        V4      ^RV: R\        V4      : R^: 24       R	# )zHelper method for testing different input types.

'given' must lead to only the pairs:
    * 1st, 1
    * 2nd, 2
    * 3rd, 3

Test cannot assume anything about order.  Docs make no guarantee and
have possible dictionary input.

ztesting z: z not found in &z: expected 2 '&'s; got z%: '&' not located in proper place in z#: unexpected number of characters: r  N)z1st=1z2nd=2z3rd=3)
re   rf   	urlencodeassertInr   r[  indexr   isdigitr   )	r   r7  	test_typeexpect_somewherer  r1  amp_locationon_amp_lefton_amp_rights	   &&&      r   help_inputtypeurlencode_Tests.help_inputtype  s     7''.(HMM(F#Xv78 ) 	c*A#V\\#%68	9 ||C(A-.Q./++-HH,2F2F2H)	* 	Vk $S[+?	@r   c                6    V P                  R RRRRR/R4       R# )1st12nd23rd3zusing dict as input typeNr  r1   s   &r   test_using_mapping"urlencode_Tests.test_using_mapping  s"    U3c5=6	8r   c                .    V P                  . ROR4       R# )r  z*using sequence of two-item tuples as inputN))r  r  )r  r  )r  r  r  r1   s   &r   test_using_sequence#urlencode_Tests.test_using_sequence  s    FH	Jr   c                   R R/p\        R 4      : R\        R4      : 2p\        P                  P                  V4      pV P	                  W#4       RR/pRp\        P                  P                  V4      pV P	                  W#4       R# )r  =zkey namezA bunch of pluseszkey+name=A+bunch+of+plusesN)r   re   rf   r  r   rD  s   &   r   test_quotingurlencode_Tests.test_quoting  sq    S	%cNIcN;''.(/0-''.(r   c                   R . RO/pR\         P                  P                  \        . RO4      4      ,          p\         P                  P	                  V4      pV P                  W#4       \         P                  P	                  VR4      pVR ,           F  pRV,          pV P                  W#4       K  	  V P                  VP                  R4      ^RVP                  R4      ,          4       R# )sequencezsequence=%sTr  zExpected 2 '&'s, got %sN)r  r  r  )re   rf   r  r  r  r   r  r[  )r   r7  r)  r  values   &    r   
test_dosequrlencode_Tests.test_doseq  s    O,!8!8_9M!NN''.(''t4:&&E"U*FMM&) ' 	c*A2V\\#5FF	Hr   c                    V P                  R \        P                  P                  / 4      4       V P                  R \        P                  P                  . 4      4       R# )r  Nr   re   rf   r  r1   s   &r   test_empty_sequence#urlencode_Tests.test_empty_sequence  s@    V\\33B78V\\33B78r   c                    V P                  R \        P                  P                  R^/4      4       V P                  R\        P                  P                  RR/4      4       R# )za=1aza=NoneNr  r1   s   &r   test_nonstring_values%urlencode_Tests.test_nonstring_values  sH     6 6Qx @A6<<#9#93+#FGr   c                j   V P                  R \        P                  P                  R^^./R4      4       V P                  R\        P                  P                  RRR./R4      4       \        P
                  ! RR.4      pV P                  R\        P                  P                  RV/R4      4       R# )za=1&a=2r  Tz
a=None&a=aNza=a&a=b)r  r   )br   )r   re   rf   r  r   r  )r   r   s   & r   test_nonstring_seq_values)urlencode_Tests.test_nonstring_seq_values  s    FLL$:$:C!Q=$$OP//tSk0BDI	K&&(';<//dTB	Dr   c                H   R
pRp\         P                  P                  VRRR7      pV P                  W#4       R
pRp\         P                  P                  V4      pV P                  W#4       R
pRp\         P                  P                  VRR7      pV P                  W#4       R	# )    %3F=%3FASCIIr-  rH  %C2%A0=%C3%81%A0=%C1r$  rA  N)r     Áre   rf   r  r   rD  s   &   r   test_urlencode_encoding'urlencode_Tests.test_urlencode_encoding  s    '''	'R( ( ''.( (''	'B(r   c                   RpRp\         P                  P                  VRRRR7      pV P                  W#4       RpRp\         P                  P                  VRRRR7      pV P                  W#4       RpRp\         P                  P                  VR4      pV P                  W#4       RpR	p\         P                  P                  VR4      pV P                  W#4       RpR
p\         P                  P                  VRRR7      pV P                  W#4       RpRp\         P                  P                  VRRR7      pV P                  W#4       R# )r  r  Tr  r-  )doseqr&  rI  z%3F=1&%3F=%3FrH  r  z%C2%A0=42&%C2%A0=%C3%81r  r$  rA  z%A0=42&%A0=%C1Nr  ))r  )r   r  ))r  )*   r  r  rD  s   &   r   test_urlencode_encoding_doseq-urlencode_Tests.test_urlencode_encoding_doseq  s@   '''T18 ( L( - ''t18 ( L( ( ''t4(-*''t4( (''ti'H(-!''ti'H(r   c                :   RpRp\         P                  P                  V4      pV P                  W#4       \         P                  P                  VR4      pV P                  W#4       RpRp\         P                  P                  VR4      pV P                  W#4       R# )   $z%A0%24=%C1%24Tz%A0%24=42&%A0%24=%C1%24N)r     $))r  )r  r  r  rD  s   &   r   test_urlencode_bytes$urlencode_Tests.test_urlencode_bytes9  s    - ''.(''t4( 4*''t4(r   c                z   Rp\         P                  P                  VRR7      pRpV P                  W24       Rp\         P                  P                  VRRR7      pRpV P                  W24       RpRp\         P                  P                  VRRR7      pV P                  W24       Rp\         P                  P                  VRRR7      pRpV P                  W24       RpRp\         P                  P                  VRRRR	7      pRpRp\         P                  P                  VRRRR7      pV P                  W24       R
# )r  z:$r"  z	%A0$=%C1$T)r  r#  z%A0$=%C1$&%A0$=13&%A0$=42r$  )r#  r&  )r  r#  r&  Nr  ))r  )r     r  r  )r   r7  r  r)  s   &   r   &test_urlencode_encoding_safe_parameter6urlencode_Tests.test_urlencode_encoding_safe_parameterG  s?   
 .''D'9(-''T'E( 9,''t$'?( .''D1: ( <(-''T1: ( < 9,''t$1: ( <(r   r3   N)r4   r5   r6   r7   r   r  r  r  r  r  r  r  r  r  r  r  r  r8   r9   rW   s   @r   r  r    sP     @@8
J
	)H9HD)&#)J)&) &)r   r  c                   P  a  ] tR tRt o RtR tR tR tR t]	P                  ! ]P                  R8H  R4      R	 4       t]	P                  ! ]P                  R8H  R
4      R 4       t]	P                  ! ]P"                  R4      R 4       tR tR tR t]	P                  ! ]P.                  R4      R 4       t]	P                  ! ]P                  R8H  R4      R 4       t]	P                  ! ]P                  R8H  R
4      R 4       t]	P                  ! ]P"                  R4      R 4       tRtV tR# )Pathname_Testsio  z&Test pathname2url() and url2pathname()c                2   \         P                  P                  R RRR4      pRp\        P                  P                  V4      pV P                  W#RV: RV: 24       \        P                  P                  V4      pV P                  WRV: RV: 24       R# )	partsofr  rt  zparts/of/a/pathpathname2url() failed; r  zurl2pathame() failed; N)rh   rt  r  re   rk   rq  r   url2pathname)r   expected_pathexpected_urlr  s   &   r   r  Pathname_Tests.test_basicr  s    WdC@(,,];v ,0	1 ,,\: -1	2r   c                0   \         P                  P                  R RR4      pR\        P                  P                  R4      ,          p\        P                  P                  V4      pV P                  W#RV: RV: 24       Tp\        P                  P                  V4      pV P                  W#RV: RV: 24       \         P                  P                  RR4      pR	\        P                  P                  R4      ,          p\        P                  P                  V4      pV P                  W#RV: RV: 24       R
p\         P                  P                  RR4      p\        P                  P                  V4      pV P                  W#RV: RV: 24       R# )needszquot=ingherezneeds/%s/herer  r  zurl2pathname() failed; z	make sureusing_quotez%s/using_quotezmake+sure/using_unquotez	make+sureusing_unquoteN)
rh   rt  r  re   rf   rg   rk   rq  r   r  rD  s   &   r   r  Pathname_Tests.test_quoting  sD    Wj&9 6<<#5#5j#AA,,U3 &*	+ ,,V4 &*	+ [-8!FLL$6$6{$CC,,U3 &*	+ *k?;,,U3 &*	+r   c                   \         P                  P                  p\        P                  P
                  pV P                  V! R 4      R 4       V P                  V! V4      R4       V P                  V! R4      R4       V P                  V! RV R24      R4       V P                  V! V RV R24      R4       V P                  V! V RV R24      R4       R# )	r  ///r  b.cza/b.c///a/b.cb%#cz///a/b%25%23cN)re   rk   rq  rh   rt  sepr   r   fnr  s   &  r   test_pathname2url Pathname_Tests.test_pathname2url  s    ^^((ggkkB$C%(C#&auCL)73se1SE-.
;se1SE./Ar   c           
     `   \         P                  P                  pRVR3RRV R2R3V RV R2R3V RV R2R3.pV FY  w  r4V P                  VR7      ;_uu_ 4        V P	                  \
        P                  P                  VR	R
7      V4       RRR4       K[  	  R#   + '       g   i     Kp  ; i)r  file:///r  r  z
file:a/b.czfile:///a/b.cr  zfile:///a/b%25%23c)rt  Trl  N)r  r   )r  zfile:a)rh   rt  r  subTestr   re   rk   rq  )r   r  subtestsrt  r  s   &    r   test_pathname2url_add_scheme+Pathname_Tests.test_pathname2url_add_scheme  s    ggkk*S\<(uAcU#0uAcU$!56
 #+D4((  NN///FV )( #+(((s   2BB-win32z#test specific to Windows pathnames.c                   \         P                  P                  pV P                  V! R 4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R	4       V P                  V! R
4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R 4       V P                  V! R!4      R"4       V P                  V! R#4      R$4       V P                  V! R%4      R4       V P                  V! R"4      R"4       V P                  V! R&4      R4       V P                  V! R'4      R4       . R)OpV F8  pV P                  V! \         P                  P	                  V4      4      V4       K:  	  R(# )*z
\\?\C:\dirz	///C:/dirz\\?\unc\server\share\dirz//server/share/dirC:///C:C:\///C:/zc:\a\b.cz///c:/a/b.czC:\a\b.cz///C:/a/b.cz	C:\a\b.c\z///C:/a/b.c/z	C:\a\\b.cz///C:/a//b.cz	C:\a\b%#cz///C:/a/b%25%23cu   C:\a\béz///C:/a/b%C3%A9C:\foo\bar\spam.foo///C:/foo/bar/spam.fooz
C:\foo:barz///C:/foo%3Abarzfoo:barz	foo%3Abarz\folder\test\///folder/test/z\\folder\test\z//folder/test/z\\\folder\test\z\\some\share\z//some/share/z\\some\share\a\b.cz//some/share/a/b.cu   \\some\share\a\b%#céz//some/share/a/b%25%23c%C3%A9zC:/a/b.cz
//?/C:/dirz//?/unc/server/share/dirN)r  r  r  )re   rk   rq  r   r  )r   r  urlsr   s   &   r   test_pathname2url_win$Pathname_Tests.test_pathname2url_win  s@    ^^((,-{;<=?STD7+FX.L)=9L)=9N+^<N+^<M*,>?N+->?457OPM*,=>I4./1BC013CD235FG/0/B568LM:;=\]J7013GHL);7679MN* CR ; ;C @A3G r   z test specific to POSIX pathnamesc                    \         P                  P                  pV P                  V! R 4      R4       V P                  V! R4      R4       V P                  V! R4      R4       R# )z//a/b.cz	////a/b.cr  z
/////a/b.cz//////a/b.cN)re   rk   rq  r   r   r  s   & r   test_pathname2url_posix&Pathname_Tests.test_pathname2url_posix  sO     ^^((I4J6K-8r   zneed os_helper.FS_NONASCIIc                2   \         P                  ! 4       p\         P                  ! 4       p\        P                  P                  \        P                  WR 7      pV P                  \        P                  P                  \        P                  4      V4       R# rH  N)sysgetfilesystemencodinggetfilesystemencodeerrorsre   rf   rg   r   FS_NONASCIIr   rk   rq  r   r&  rI  r   s   &   r   test_pathname2url_nonascii)Pathname_Tests.test_pathname2url_nonascii  sb    ,,...0ll  !6!6 Y44Y5J5JKSQr   c                   \         P                  P                  p\        P                  P
                  pV P                  V! R 4      R 4       V P                  V! R4      V 4       V P                  V! R4      V 4       V P                  V! R4      V V 24       V P                  V! R4      R4       V P                  V! R4      RV R24       V P                  V! R4      V RV R24       V P                  V! R4      V RV R24       V P                  V! R	4      V RV R24       V P                  V! R
4      V V RV R24       V P                  V! R4      R4       V P                  V! R4      RV V R24       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       R# )r  r"  r  z////foozfoo/barbar/foo/barz//localhost/foo/barz
///foo/barz////foo/bar	data:blahzdata://blahdata:blahzfoo?barzfoo#barzfoo?bar=bazzfoo?bar#bazz	foo%3Fbarz	foo%23barzfoo%3Fbar%3Dbazzfoo%3Fbar%23bazN)re   rk   r  rh   rt  r  r   r  s   &  r   test_url2pathname Pathname_Tests.test_url2pathname  s   ^^((ggkkB$CSE+Ese-FuSE]3EE*I#cU#7JC5C5)<=12se3se34GHL)cU#cU#+>?M*seC5C5,DEK+6M*eC5T,BCI.I.M*E2M*E2K)4K)4-.>-.>r   c                   \         P                  P                  pRRRRV 3RV 3RV V 23RRRV R23RV RV R23RV RV R23R	V RV R23R
V V RV R23RRRV V R23.pV FY  w  r4V P                  VR7      ;_uu_ 4        V P	                  \
        P                  P                  VRR7      V4       RRR4       K[  	  R#   + '       g   i     Kp  ; i)r   zfile:/r  z	file:////r  zfile:foo/barr	  zfile:/foo/barzfile://localhost/foo/barzfile:///foo/barzfile:////foo/barzfile:data://blahr  r  r   Trequire_schemeN)r   r  )zFILE:r  )zFiLe:r  )zfile:foor  )zfile:data:blahr  )rh   rt  r  r  r   re   rk   r  )r   r  r  r   r  s   &    r    test_url2pathname_require_scheme/Pathname_Tests.test_url2pathname_require_scheme  s    ggkk# C5"SE#-(s3%s^,SS12'C5C5)<=3%s3%s 34C5SS!9:+5cU$!78
  #+C#&&  NN//D/I!# '& #+&&&s   2CCc           
        . ROpV Fk  pV P                  VR7      ;_uu_ 4        V P                  \        P                  P                  \        P
                  P                  VRR7       RRR4       Km  	  R#   + '       g   i     K  ; i)r  r  Tr  N)r  :r  zhttp:foozlocalfile:foozdata:foozdata:file:foozdata:file://foo)r  r   re   r   r   rk   r  )r   r  r   s   &  r   'test_url2pathname_require_scheme_errors6Pathname_Tests.test_url2pathname_require_scheme_errors  sj    	
 C#&&!!LL))NN// " . '& &&&s   AA88B	zAFixed by https://github.com/emscripten-core/emscripten/pull/24593c                   \         P                  P                  p\        P                  P
                  pV P                  V! R RR7      V RV R24       V P                  V! R\        P                  ! 4        R24      V RV R24       V P                  V! R\        P                  ! 4        R2RR7      V RV R24       R# )//127.0.0.1/foo/barT)resolve_hostr  r	  r8  r
  N)	re   rk   r  rh   rt  r  r   socketgethostnamer  s   &  r   test_url2pathname_resolve_host-Pathname_Tests.test_url2pathname_resolve_host,  s    ^^((ggkk1E#cRUQVVYGZ[b!3!3!5 6h?@SESEQTBUVb!3!3!5 6h?dSX[W\\_`c_ddgUhir   c                   \         P                  P                  pV P                  V! R 4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R	4      R4       V P                  V! R
4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R4      R4       V P                  V! R 4      R!4       V P                  V! R"4      R#4       V P                  V! R$4      R%4       V P                  V! R&4      R'4       V P                  V! R(4      R'4       V P                  V! R)4      R'4       V P                  V! R*4      R+4       V P                  V! R,4      R4       V P                  V! R-4      R4       V P                  V! R.4      R/4       V P                  V! R04      R'4       V P                  V! R14      R24       V P                  V! R34      R44       . R6OpV F8  pV P                  V! \         P                  P	                  V4      4      V4       K:  	  R5# )7z/C:/r  z//C:r  z//C:/z//C:\z//C:80/zC:80\z///C|r  r  z/C|//zC:\\z
///C|/pathzC:\pathz
///C/test/z\C\test\z////C/test/z	\\C\test\zc:/path/to/filezc:\path\to\filezC:/path/to/filezC:\path\to\filezC:/path/to/file/zC:\path\to\file\zC:/path/to//filezC:\path\to\\filezC|/path/to/filez/C|/path/to/filez///C|/path/to/filez///C|/foo/bar/spam.foor  u   ///è|/u   è:\z//host/share/spam.txt:eggsz\\host\share\spam.txt:eggsz///c:/spam.txt:eggszc:\spam.txt:eggsz//server/path/to/filez\\server\path\to\filez////server/path/to/filez/////server/path/to/filez//127.0.0.1/path/to/filez\\127.0.0.1\path\to\filez//localhost/C:/path/to/filez//localhost/C|/path/to/filez//localhost/path/to/filez\path\to\filez //localhost//server/path/to/filezC:/foo%2fbarz
C:\foo/barz//server/share/foo%2fbarz\\server\share\foo/barN)r  z	\C\test\\r  )re   rk   r  r   rq  )r   r  pathsrt  s   &   r   test_url2pathname_win$Pathname_Tests.test_url2pathname_win4  s    ^^((FV,FT*Gf-Hv.I1Gd+Gd+Hv.Gh/L):6L)=9M*O<-.0DE-.0DE./1GH./1GH-.0DE./1EF013GH457OPM*K889;[\124GH346RS568TU679UV679XY9:<PQ9:<PQ679KL>?A]^N+];679UV) DR ; ;D ABDI r   c                >   \         P                  P                  pV P                  \         P                  P
                  VR 4       V P                  \         P                  P
                  VR4       V P                  \         P                  P
                  VR4       V P                  \         P                  P
                  VR4       V P                  \         P                  P
                  VR4       V P                  \         P                  P
                  VR4       R# )z	//foo/barz//localhost:/foo/barz//:80/foo/barz//:/foo/barz//c:80/foo/barr  N)re   rk   r  r   r   r   r  s   & r   test_url2pathname_posix&Pathname_Tests.test_url2pathname_posixf  s     ^^((&,,//[A&,,//5KL&,,//_E&,,//]C&,,//5EF&,,//5JKr   c                   \         P                  ! 4       p\         P                  ! 4       p\        P                  pV P                  \        P                  P                  V4      \        P                  4       \        P                  P                  W1VR 7      pV P                  \        P                  P                  V4      \        P                  4       R# r  )r   r  r  r   r  r   re   rk   r  rf   rg   r  s   &   r   test_url2pathname_nonascii)Pathname_Tests.test_url2pathname_nonasciiq  s    ,,...0##44S99;P;PQll   G44S99;P;PQr   r3   N)r4   r5   r6   r7   r   r  r  r  r  r  r  r   platformr  skipIfr  r   r  r  r  r  r  r   is_emscriptenr  r#  r&  r)  r8   r9   rW   s   @r   r  r  o  sh    02+6	BV 0>@"H@"HH __S\\W,79999 ..0LMR NR?2#0.$ __W**,opj qj 0>@.J@.J` __S\\W,79L9L ..0LMR NRr   r  c                   *   a  ] tR tRt o RtR tRtV tR# )Utility_Testsiz  z=Testcase to test the various utility functions in the urllib.c                j    V P                  \        P                  P                  4       \        4       R# )zATest the urllib.request.thishost utility function returns a tupleN)r   re   rk   thishosttupler1   s   &r   test_thishostUtility_Tests.test_thishost}  s    fnn557?r   r3   N)r4   r5   r6   r7   r   r3  r8   r9   rW   s   @r   r/  r/  z  s     G@ @r   r/  c                   0   a  ] tR tRt o RtR tR tRtV tR# )RequestTestsi  z&Unit tests for urllib.request.Request.c                    \         P                  P                  pV! R 4      pV P                  VP	                  4       R4       V! R / 4      pV P                  VP	                  4       R4       R# )r  r   POSTN)re   rk   Requestr   
get_methodr   r9  rk   s   &  r   test_default_values RequestTests.test_default_values  s[    ..((12++-u5126++-v6r   c                   \         P                  P                  pV! R RR7      pV P                  VP                  R4       V P                  VP                  4       R4       V! R / RR7      pV P                  VP                  R4       V P                  VP                  4       R4       V! R RR7      pV P                  VP                  4       R4       RVn        V P                  VP                  4       R4       R# )r  HEAD)methodr   N)re   rk   r9  r   r@  r:  r;  s   &  r   test_with_method_arg!RequestTests.test_with_method_arg  s    ..((1&A0++-v612fE0++-v61%@++-u5++-v6r   r3   N)	r4   r5   r6   r7   r   r<  rA  r8   r9   rW   s   @r   r6  r6    s     077 7r   r6  __main__rV   )-r   urllib.parsere   urllib.requesturllib.errorhttp.clientrH   email.messager   r&   r  testr   test.supportr   r   rh   r  r  ImportErrorr   ro  r   has_gethostnameSkipTestr   rK   objectrM   TestCaserY   r   r   r  r  r  r  r  rT  r  r  r/  r6  r4   mainr3   r   r   <module>rQ     s   A      	   " & 	     $$$


9
::,^<F <bb)) bbJD9"" D9N!C 1 1 !CHS,))= S,lKP)) KP\H-H-- H-V*"H--} *"ZJL8$$ JLZRIX&& RIjA)h'' A)FIRX&& IRV@H%% @78$$ 70 zMMO S4  
Cs   F0 0	F=<F=