python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_urllib.cpython-312.pyc

Αe<dZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZddlmZddlmZddlZ	ddlZddlZddlZddlmZmZdd	lmZddlZej<se
j>d
dZ da!d4dZ"d
Z#d5dZ$Gdde%Z&Gdde%Z'Gdde
jPZ)Gdde
jPZ*Gdde
jPZ+Gdde
jPe&e'Z,Gdde
jPZ-Gdde
jPZ.Gdd e
jPe&Z/Gd!d"e
jPZ0Gd#d$e
jPZ1Gd%d&e
jPZ2Gd'd(e
jPZ3Gd)d*e
jPZ4Gd+d,e&e
jPZ5Gd-d.e
jPZ6Gd/d0e
jPZ7Gd1d2e
jPZ8e9d3k(re
jtyy#e$rdZYwxYw)6z;Regression tests for what was in Python 2's "urllib" moduleN)patch)support)	os_helper)
socket_helper)warnings_helper)url2pathnamepathname2url)	b64encodeztest requires gethostname()c|tt|ddj}t|dk(rd|z}d|zS)z!Escape char as RFC 2396 specifiesNz0%s%)hexordupperlen)charhex_reprs  D/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_urllib.py	hexescaper s?3t9~ab!'')H
8}8#>c|!tjj|}nts
t}|ant}||j	|S|j	||S)z.urlopen(url [, data]) -> open file-like object)proxies)urllibrequestFancyURLopener
_urlopeneropen)urldataropeners    rurlopenr"+s[..w.?
!
|{{3{{3%%rctjdtf5tjjcdddS#1swYyxYw)Nz8FancyURLopener style of invoking requests is deprecated.)rcheck_warningsDeprecationWarningrrrrrrr;sB		'	'
G
 
!/~~,,.///sAA
cGfddtjGfddtjj|_S)Nc8eZdZdZfdZdZddZddZdZy)	fakehttp.<locals>.FakeSocketr
c|_yN)buf)selfr FakeHTTPConnections  rsendallz$fakehttp.<locals>.FakeSocket.sendallFs%)"rc0|xjdz
c_|S)Nr
)io_refs)r-argskwdss   rmakefilez%fakehttp.<locals>.FakeSocket.makefileIsLLALKrNc\|jrytjj||SNr)closedioBytesIOread)r-amts  rr:z!fakehttp.<locals>.FakeSocket.readMs!{{::??4--rc\|jrytjj||Sr6)r7r8r9readline)r-lengths  rr=z%fakehttp.<locals>.FakeSocket.readlineRs#{{::&&tV44rc|xjdzc_|jdk(r tjj|yy)Nr
r)r1r8r9closer-s rr@z"fakehttp.<locals>.FakeSocket.closeWs3LLAL||q 

  &!rr+)	__name__
__module____qualname__r1r/r4r:r=r@)r.sr
FakeSocketr)Cs!	*		.
	5
	'rrEc*eZdZdZfdZWrdZyy)$fakehttp.<locals>.FakeHTTPConnectionNch|j|_|jt|_yr+)fakedatasocktypefakesock)r-rEs rconnectz,fakehttp.<locals>.FakeHTTPConnection.connectas#"4==1DI"&))DJrcyr+r&rAs rr@z*fakehttp.<locals>.FakeHTTPConnection.closejr)rBrCrDr,rMr@)rE
mock_closesrr.rG\s	,

rr.)r8r9httpclientHTTPConnectionrI)rIrPr.rEs `@@rfakehttprTBs:'RZZ'2T[[77 #+rceZdZddZdZy)
FakeHTTPMixinct||}tjj|_|tj_y)NrP)rTrQrRrS_connection_class)r-rIrPfake_http_classs    rrTzFakeHTTPMixin.fakehttprs,"8
C!%!;!;%4"rcB|jtj_yr+)rYrQrRrSrAs r
unfakehttpzFakeHTTPMixin.unfakehttpws%)%;%;"rNF)rBrCrDrTr\r&rrrVrVqs5
<rrVceZdZdZdZy)FakeFTPMixincGddt}tjj|_|tj_y)Nc$eZdZ		ddZdZdZy),FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapperNcyr+r&)r-userpasswdhostportdirstimeout
persistents        r__init__z5FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapper.__init__~src.tjdfS)Nr)r8r9)r-filerKs   rretrfilez5FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapper.retrfileszz|Q&rcyr+r&rAs rr@z2FakeFTPMixin.fakeftp.<locals>.FakeFtpWrapper.closerOr)NT)rBrCrDrkrnr@r&rrFakeFtpWrapperrb}sHL $

'
rrp)objectrr
ftpwrapper_ftpwrapper_class)r-rps  rfakeftpzFakeFTPMixin.fakeftp|s.		V		"(!:!:$2!rcB|jtj_yr+)rsrrrrrAs r	unfakeftpzFakeFTPMixin.unfakeftps$($:$:!rN)rBrCrDrtrvr&rrr_r_{s
3;rr_cpeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZy)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.

    ctd|jjzd|_t	t
jd}	|j|j|jt
j|_	tjj|j|_
td|jz|_y#|jwxYw)Nztest_urllib: %s
asciiwbfile:%s)bytes	__class__rBtextrrTESTFNwriter@pathnamerparsequotequoted_pathnamer"returned_obj)r-fs  rsetUpzurlopen_FileTests.setUps-0G0GG!#	!!4(	
GGDII
GGI!((
%||11$--@#I0D0D$DE
GGIsCC"c~|jjtjtj
y)zShut down the open objectN)rr@osremoverrrAs rtearDownzurlopen_FileTests.tearDowns&!
		)""#rcddD]+}|jt|j|d|z-y)N)	r:r=	readlinesfilenor@infogeturlgetcode__iter__/object returned by urlopen() lacks %s attribute)
assertTruehasattrrr-attrs  rtest_interfacez urlopen_FileTests.test_interfaces:G	DOOGD$5$5t<J
	rcl|j|j|jjyr+)assertEqualrrr:rAs r	test_readzurlopen_FileTests.test_reads%D$5$5$:$:$<=rc|j|j|jj|jd|jjdy)NrzKcalling readline() after exhausting the file did not return an empty string)rrrr=rAs r
test_readlinezurlopen_FileTests.test_readlinesKD$5$5$>$>$@Ad//88:3	4rc|jj}|jt|dd|j|d|jdy)Nr
z.readlines() returned the wrong number of linesrz"readlines() returned improper text)rrrrr)r-
lines_lists  rtest_readlinesz urlopen_FileTests.test_readlinessM&&002
Z!I	KA		=	?rc|jj}|j|td|j	tj|t|j|jdy)Nzfileno() did not return an intzTReading on the file descriptor returned by fileno() did not return the expected text)	rrassertIsInstanceintrrr:rr)r-file_nums  rtest_filenozurlopen_FileTests.test_filenosW$$++-h-MN3tyy>:DII<	=rc8|jjyr+)rr@rAs r
test_closezurlopen_FileTests.test_closes	
!rc|j|jjtjj
yr+)rrheadersemailmessageMessagerAs rtest_headerszurlopen_FileTests.test_headerss(d//779N9NOrcd|j|jj|jyr+)rrrrrAs rtest_urlzurlopen_FileTests.test_urls$**..0D0DErcN|j|jjyr+)assertIsNonerstatusrAs rtest_statuszurlopen_FileTests.test_statuss$++223rc|j|jjtjj
yr+)rrrrrrrAs r	test_infozurlopen_FileTests.test_infos+d//446

8M8MNrcl|j|jj|jyr+)rrrrrAs rtest_geturlzurlopen_FileTests.test_geturls'**113T5I5IJrcV|j|jjyr+)rrrrAs rtest_getcodezurlopen_FileTests.test_getcodes$++3356rc^|jD]}|j||j yr+)rrr)r-lines  r	test_iterzurlopen_FileTests.test_iters-%%	.DT499-	.rc||jttjjd|j
zy)Nz./)assertRaises
ValueErrorrrr"rrAs rtest_relativelocalfilez(urlopen_FileTests.test_relativelocalfiles'*V^^%;%;D4==<PQrN)rBrCrD__doc__rrrrrrrrrrrrrrrrr&rrrxrxs]F$
>4?="
PF4OK7.Rrrxc0eZdZdZdZdZdZdZdZy)
ProxyTestsc|jtj|_t	t
jD]0}d|jvs|jj|2y)Nproxy)	enterContextrEnvironmentVarGuardenvlistrenvironlowerunset)r-ks  rrzProxyTests.setUpsS$$Y%B%B%DEbjj!	"A!'')#q!	"rc|jjddtjj	}|jd|d|jjdd|j
tjjd|j
tjjd|j
tjjdy)NNO_PROXY	localhostno0localhost, anotherdomain.com, newdomain.com:1234anotherdomain.comanotherdomain.com:8888newdomain.com:1234)rsetrrgetproxies_environmentrrproxy_bypass_environmentr-rs  r+test_getproxies_environment_keep_no_proxiesz6ProxyTests.test_getproxies_environment_keep_no_proxiessZ-..779gdm4Z!ST??@STU??@XYZ??@TUVrc	|jjddtjj	}|jd|d|jjddtjj	}|j
d||jjd|jjdy#|jjd|jjdwxYw)N
HTTP_PROXYhttp://somewhere:3128rQREQUEST_METHODGET)rrrrrrassertNotInrrs  rtest_proxy_cgi_ignorez ProxyTests.test_proxy_cgi_ignores		)HHLL'>?nn;;=G4gfoFHHLL)51nn;;=GVW-HHNN+,HHNN<(
HHNN+,HHNN<(sBC8Dctjj}|jj	dd|j|d|j|d|j|d|j|d|j|d|j|d|j|d	|j|d
|j|d|j|d|j|d
|j
|d|j
|d|j
|dy)Nrz8localhost, anotherdomain.com, newdomain.com:1234, .d.o.tr	LocalHost	LOCALHOSTz
.localhostrz.newdomain.com:1234z	foo.d.o.tzd.o.trz.anotherdomain.com:8888zwww.newdomain.com:1234prelocalhost
newdomain.comznewdomain.com:1235rrrrrrassertFalser-bypasss  r(test_proxy_bypass_environment_host_matchz3ProxyTests.test_proxy_bypass_environment_host_match
s 88ZO	Q{+,{+,{+,|,-345456{+,w(78989:789/001 456rctjj}|jj	dd|j|d|j|d|jj	dd|j|d|j
|d|j
|dy)Nr*rrz*, anotherdomain.comrrrs  r*test_proxy_bypass_environment_always_matchz5ProxyTests.test_proxy_bypass_environment_always_match s88Z%/0345Z!7823401 456rctjj}|jj	dd|j|d|j|d|j|dy)Nrrz
localhost
zanotherdomain.com:8888
znewdomain.com:1234
)rrrrrrrs  r%test_proxy_bypass_environment_newlinez0ProxyTests.test_proxy_bypass_environment_newline*sb88ZG	I
./ :;< 678rN)	rBrCrDrrrrrrr&rrrrs!"	W
)7&79rrceZdZdZdZdZy)ProxyTests_withOrderedEnvchtj|_tjt_yr+)rr
_saved_envcollectionsOrderedDictrAs rrzProxyTests_withOrderedEnv.setUp5s** ,,.
rc.|jt_yr+)rrrrAs rrz"ProxyTests_withOrderedEnv.tearDown;s
__
rc~dtjd<dtjd<|jtjjd|jtjjddtjd<dtjd<tjj
}|ji|d	tjd<d
tjd<|jtjjd|jtjjd|jtjjd|jtjjd
|jtjjddtjd<dtjd<tjj
}|jd|dy)Nno_proxyrNo_Proxy	arbitrary
http_proxyrrz%localhost, noproxy.com, my.proxy:1234zxyz.comznoproxy.com:5678z
my.proxy:1234zmy.proxyzhttp://somewhereelse:3128
Http_ProxyrQ)	rrrrrrrrrrs  r,test_getproxies_environment_prefer_lowercasezFProxyTests_withOrderedEnv.test_getproxies_environment_prefer_lowercase>s!#

:!,

:@@MN@@MN#%

< #:

< ..779W%!H

:!*

:??LM??@RST??PQ@@LM@@MN#:

< #>

< ..7790'&/BrN)rBrCrDrrrr&rrrr3s/%CrrceZdZdZdZdZdZeje	ddZ
eje	ddZeje	ddZeje	dd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZej4ej8dddZdZdZdZ eje	ddZ!y)urlopen_HttpTestsz.Test urlopen() opening a fake http connection.c|jd|zdz	td}|j|jd|j|jd|j|j	d|j|jd|j
y#|j
wxYw)NsHTTP/s 200 OK

Hello!http://python.org/Hello!rrTr"rr=rrr\)r-verfps   r
check_readzurlopen_HttpTests.check_readZs

hn'??@	-.BR[[]I6R[[]C0RYY[*>?RZZ\3/OODOOsBB55Ccd}|jd	tjj|}|j	|j||j
y#|j
wxYw)Nz-http://docs.python.org/library/urllib.html#OKHTTP/1.1 200 OK

Hello!)rTrrr"rrr\)r-rr	s   rtest_url_fragmentz#urlopen_HttpTests.test_url_fragmentesX=

67	'',BRYY[#.OODOOs?A%%A7c|jd	td}|j|jj|jy#|jwxYw)Nrhttp://www.python.org)rTr"rr	
will_closer\)r-resps  rtest_willclosez urlopen_HttpTests.test_willcloseosJ

67	23DOODGG../OODOOs0AA&zssl module requiredcttdddgzD]}t|}d|d}|jd	t	|jdd}tjj}|j|d	|5tjjd
|ddd|j|d	|5tjjd|dddtd
|}|j||j|jy#1swYxYw#1swYWxYw#|jwxYw)Nr!z//localhost:7777/test/HTTP/1.1 200 OK

Hello.\\\contain control.*http:https:)rrangechrrTreprreplacerQrR
InvalidURLassertRaisesRegexrrr"rrr\)r-char_norschemeless_urlescaped_char_reprr!rs       r(test_url_path_with_control_char_rejectedz:urlopen_HttpTests.test_url_path_with_control_char_rejectedwsYE!TN+tf4	"Gw<D4TF!<NMM:;
"%)J$6$6tU$C!![[33
++"34E3F GIENN**U>2B+CDE++"34E3F GIFNN**VN3C+DEF~&678  t{{}5!/	"EEFF!s=A
E#D8.E#E.6E8E	=EE
		EE"c|jdd}d|zdz}	tjj}|j	|d5t
jjd|ddd|j	|d5t
jjd|dddtd|}|jd	|j|jd
|j|jd|j|jy#1swYxYw#1swYxYw#|jwxYw)Nrz:localhost:7777?a=1 HTTP/1.1
X-injected: header
TEST: 123//:8080/test/?test=az*contain control.*\\r.*(found at least . .)rcontain control.*\\nr 

)rTrQrRr!r"rrr"rrr\)r-rfr$r!rs     r4test_url_path_with_newline_header_injection_rejectedzFurlopen_HttpTests.test_url_path_with_newline_header_injection_rejecteds4

67O';;	//J''IK
A&&~.>'?@
A''
4KL
B&&/?'@A
BU>"234DS$++-0T4;;=1T4;;=1OO
A
A
B
B
OOs<,E	#D0,E#D<)A6E0D95E<EEEcttdddgzD]}t|}d|d}|jd	t	|jdd}tjj}|j|d	|5td
|ddd|j|d	|5td|ddd|jy#1swYHxYw#1swY(xYw#|jwxYw)Nrrrz//localhostz/test/rrrrrr)rrrrTrr rQrRr!r"r"r\)r-r#rr$r%r!s      r(test_url_host_with_control_char_rejectedz:urlopen_HttpTests.test_url_host_with_control_char_rejectedsE!TN+tf4
	"Gw<D*4&7NMM:;	
"$(J$6$6tU$C!![[33
++"34E3F GI6eN#3456++J:KL]K^8_`7f^$4567!
	"6677!s=A
C8
C C86C,C8 C)	%C8,C5	1C88D
c|jdd}d|zdz}	tjj}|j	|d5td|ddd|j	|d5td|ddd|j
y#1swYCxYw#1swY&xYw#|j
wxYw)	Nrzlocalhost
X-injected: header
r(r)zcontain control.*\\rrr*r)rTrQrRr!r"r"r\)r-rfr$r!s    r4test_url_host_with_newline_header_injection_rejectedzFurlopen_HttpTests.test_url_host_with_newline_header_injection_rejecteds

674';;	//J''35
2%/01
2''
4KL
3& 012
3
OO

2
2
3
3
OOs;,B2	BB22B&B2B#B2&B/+B22Cc&|jdy)Ns0.9r
rAs r
test_read_0_9zurlopen_HttpTests.test_read_0_9s	
rc&|jdy)Ns1.0r4rAs r
test_read_1_0zurlopen_HttpTests.test_read_1_0rc&|jdy)Ns1.1r4rAs r
test_read_1_1zurlopen_HttpTests.test_read_1_1r8rc|jdd	|jttd|j	y#|j	wxYw)NsHTTP/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
TrXrrTrOSErrorr"r\rAs rtest_read_bogusz!urlopen_HttpTests.test_read_bogussJ


			gw0DEOODOOsAAc|jdd	d}|jtjj|5tdddd|j
y#1swYxYw#|j
wxYw)NsHTTP/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
TrXzRedirection to url 'file:r)rTr"rerror	HTTPErrorr"r\)r-msgs  rtest_invalid_redirectz'urlopen_HttpTests.test_invalid_redirectsx


			-C''(>(>D
.,-
.
OO
.
.
OOs#,A2A&
A2&A/+A22BcttjD]U}|jdd	|j	t
jjtd|jWy#|jwxYw)Ns_HTTP/1.1 302 Found
Location: file://guidocomputer.athome.com:/python/license
Connection: close
TrXhttp://something)
rrmaxtriesrTrrr@rAr"r\)r-is  rtest_redirect_limit_independentz1urlopen_HttpTests.test_redirect_limit_independentsz~'001		"AMM


"!!&,,"8"8'&(!		"!s/A77B	c|jd	|jttd|j	y#|j	wxYw)NrrEr<rAs rtest_empty_socketz#urlopen_HttpTests.test_empty_sockets=	


c	gw0BCOODOOs	?Ac*|jtjj5}t	dddd|jjj|j|jjy#1swYTxYw)Nz/file://localhost/a/file/which/doesnot/exists.py)	rrr@URLErrorr"r	exceptionfilenamereasonr-es  rtest_missing_localfilez(urlopen_HttpTests.test_missing_localfilesj


v||44
5	GEF	G,,-**+	G	GB		Bctj\}}d|jtjj
dz}	|j
tjj|t|5}|j
|dddtj|tj||jtjj||jtjj5t|dddy#1swYxYw#tj|tj|wxYw#1swYyxYw)Nzfile://localhost/r)tempfilemkstempr rpathseprexistsr"r@unlinkrrrr@rL)r-fdtmp_filetmp_fileurlfobjs     rtest_file_notexistsz%urlopen_HttpTests.test_file_notexistss'')H)H,<,<RWW[[#,NN	 OOBGGNN845%
&%
&
HHRLIIh12


v||44
5	!K 	!	!

&
&
HHRLIIh	!	!s09D;?D/D;E*/D84D;;,E'*E3c.d}|jtjj5}t	|ddd|jjj|j|jjy#1swYTxYw)Nzftp:///path
rrr@rLr"rrMrNrrO)r-test_ftp_urlrQs   rtest_ftp_nohostz!urlopen_HttpTests.test_ftp_nohost sl$


v||44
5	"L!	"--.**+	"	"sBBc*|jtjj5}t	dddd|jjj|j|jjy#1swYTxYw)Nz.ftp://localhost/a/file/which/doesnot/exists.pyrarPs  rtest_ftp_nonexistingz&urlopen_HttpTests.test_ftp_nonexisting'sl


v||44
5	FDE	F--.**+	F	FrSMAXFTPCACHErc|j	tjjddddgtjjd<td|j
y#|j
wxYw)Nrdpassrtestzftp://localhost)rtrrrrftpcacher"rvrAs rtest_ftp_cache_pruningz(urlopen_HttpTests.test_ftp_cache_pruning-s]	.4nn.G.GPVXcegik.lFNN##F+%&NNDNNsA	A,,A>c|jd	td}|j|jd|j|jd|j|j	d|j|jd|j
y#|j
wxYw)NHTTP/1.0 200 OK

Hello!zhttp://user:pass@python.org/rrrr)r-r	s  rtest_userpass_inurlz%urlopen_HttpTests.test_userpass_inurl6s

67	78BR[[]I6R[[]C0RYY[*HIRZZ\3/OODOOsBB//Cc|jd	d}dj|}tjj}dt|j
djdz}t|}|j||jjd|j|jd|j|jd|j|j||j|jd	|j!y#|j!wxYw)
Nrnza b:c dzhttp://{}@python.org/zAuthorization: Basic %s
ASCIIzUTF-8rrr)rTformatrQrRrSr
encodedecoder"assertInr,rr=assertNotEqualrrr\)r-userpassrfakehttp_wrapper
authorizationr	s      rtest_userpass_inurl_w_spacesz.urlopen_HttpTests.test_userpass_inurl_w_spacesAs

67	 H)00:C#{{99:&xw'?@GGPQMBMM-)9)=)=)D)DW)MNR[[]I6R[[]C0		S1RZZ\3/OODOOsDD33Ectjdtf5tjjdddy#1swYyxYwNr)rr$r%rr	URLopenerrAs rtest_URLopener_deprecationz,urlopen_HttpTests.test_URLopener_deprecationTs;

+
+R0B,C
D	'NN$$&	'	'	'sAA
c$tj}tjdtf5|jt5tjjdd|ddddddy#1swYxYw#1swYyxYw)Nrzhttps://localhostz/nonexistent/path)cafilecontext)
sslcreate_default_contextrr$r%rrrrr")r-rs  rtest_cafile_and_contextz)urlopen_HttpTests.test_cafile_and_contextXs,,.

+
+R1C,D
E	"":.
&&'0CW'
		

		s#B#A:)B:B	?BBN)"rBrCrDrr
r
runittest
skipUnlessrr&r.r0r2r5r7r:r>rCrHrJrRr_rcrerrqrrrlrorzr~rr&rrrrWs58	X34"5"4X3452X34"5" X345 
   ",!,,U\\&..-34	&'X345rrcFeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)urlopen_DataTestsz"Test urlopen() opening a data URL.c|jtjjd|_d|_d|_d|_d|_tjj|j|_
tjj|j|_tjj|j|_y)Nutest data URLs :;,%=& ö Ä sUPNG


IHDR{@sRGBIDATc```?
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%20)
addCleanuprr
urlcleanuprimagetext_urltext_url_base64	image_urlr"
text_url_resptext_url_base64_respimage_url_resprAs rrzurlopen_DataTests.setUpes112;	
F	

(	


	

.	

$^^33DMMB$*NN$:$:  %"!$nn44T^^DrcddD]+}|jt|j|d|z-y)N)r:r=rr@rrrrr)rrrrs  rrz urlopen_DataTests.test_interfaces:G	DOOGD$6$6=J
	rc(|j|jjtjj
|j
|jjjddg|j
|jjdtt|j|j
tjjdjjddgy)N)z
text/plainr)charsetz
ISO-8859-1zcontent-lengthzdata:,)rzUS-ASCII)rrrrrrrr
get_paramsrstrrrrrr"rAs rrzurlopen_DataTests.test_infosd005579N9NO22779DDF
!:;	=,,1134DEDJJ 	"//9>>@KKM
!89	;rc<|j|jj|j|j|jj|j
|j|jj|jyr+)rrrrrrrrrAs rrzurlopen_DataTests.test_geturlsp++224dmmD2299;  	",,335t~~Frc|j|jjjt	|jjj
d|jyNr)rrr:rtdictrrrrAs rtest_read_textz urlopen_DataTests.test_read_textsZ++00299##((*5578CEFJii	Qrc|j|jjjt	|jjj
d|jyr)rrr:rtrrrrrAs rtest_read_text_base64z'urlopen_DataTests.test_read_text_base64sY22779@@**//1<<>?	JLII	rcl|j|jj|jyr+)rrr:rrAs rtest_read_imagez!urlopen_DataTests.test_read_images%,,113TZZ@rcb|jttjjdy)Nzdata:text/plainrrrrr"rAs rtest_missing_commaz$urlopen_DataTests.test_missing_commas*V^^%;%;<MNrcb|jttjjdy)Nzdata:;base64,Cg=rrAs rtest_invalid_base64_dataz*urlopen_DataTests.test_invalid_base64_datas*V^^%;%;<NOrN)
rBrCrDrrrrrrrrrrr&rrrrbs8,E>;GQ
AOPrrcTeZdZdZdZdZdZddZdZdZ	dZ
d	Zd
ZdZ
dZy
)urlretrieve_FileTestsz(Test urllib.urlretrieve() on local filesc|jtjjg|_|jtjd|_	ttjd}|j|j|j|jy#YyxYw#jw#YwxYwxYw)Nstesting urllib.urlretriever{)rrrr	tempFilesregisterFileForCleanUprrrrrr@)r-FILEs  rrzurlretrieve_FileTests.setUps112	
##I$4$451			(($/DJJtyy!JJLDDs1AB5B..B25C6CCC	Cc^|jD]}tj|y#YxYwr+)rrr)r-eachs  rrzurlretrieve_FileTests.tearDowns'NN	D4	Ds(,ctjj|}	|jddtjj|zS#t$rtjdwxYw)Nzutf-8z!filePath is not encodable to utf8z	file://%s)
rrWabspathrsUnicodeEncodeErrorrSkipTestrrr	)r-filePaths  rconstructLocalFileUrlz+urlretrieve_FileTests.constructLocalFileUrlsg77??8,	IOOG$V^^88BBB"	I##$GHH	IsAA3c.tj\}}	|j|tj|d}|j||j
|j
|S#Y|SxYw#j
w#YwxYwxYw)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{)rUrVrrfdopenrr@)r-r newFdnewFilePathnewFiles     rcreateNewTempFilez'urlretrieve_FileTests.createNewTempFiles
&--/{	''4iit,GMM$MMO
DDs0AA;!A33A8;B<B
B
BBc:|jj|yr+)rappend)r-fileNames  rrz,urlretrieve_FileTests.registerFileForCleanUpsh'rctjjdtjz}|j|dtj|j
|dtjjdy)Nr|rr
zFdid not get an email.message.Message instance as second returned value)
rrurlretrieverrrrrrr)r-results  r
test_basicz urlretrieve_FileTests.test_basicsb++I	8H8H,HII$4$45fQi)>)>9	:rcFdtjz}|j|tjj|j
tj|}|j||d|jtjj|dt|d}	|j}|j|j|j|j|y#Y!xYw#|jw#YwxYwxYw)N%s.2rzcopy of the file was not maderb)rrrrrrrrrrrWrYrr:r@r)r-second_temprrrs     r	test_copyzurlretrieve_FileTests.test_copysy///##K0++D,F,F-*,fQi0{369	:K&	99;DJJLD)
DDs03 DDDD DD DD cdgffd	}dtjz}j|tjjj
tj||y)Nrcj|tj|tj|tj||d|ddz|d<y)Nrr
)rrr)block_countblock_read_size	file_sizecount_holderr-s    r
hooktesterz9urlretrieve_FileTests.test_reporthook.<locals>.hooktestersY!!+s3!!/37!!)S1[,q/:*1o1LOrr)rrrrrrr)r-rrs`  rtest_reporthookz%urlretrieve_FileTests.test_reporthooksXNOS	2y///##K0""&&y'7'78	%rcg}|fd}|j}tjj|j	|t
j||jt|d|j|dddy)Nc,|j|||fyr+rrrr_reports    rrzAurlretrieve_FileTests.test_reporthook_0_bytes.<locals>.hooktesterNNK)DErr
rr	rrrrrrrrrr-reportrsrcFileNames    rtest_reporthook_0_bytesz-urlretrieve_FileTests.test_reporthook_0_bytesstHN	F,,.""4#=#=k#Jj	*Va(1q)rcFg}|fd}|jd}tjj|j	|t
j||jt|d|j|ddd|j|dddy)Nc,|j|||fyr+rrs    rrzAurlretrieve_FileTests.test_reporthook_5_bytes.<locals>.hooktester$rrsxxxxxrrr
rrs    rtest_reporthook_5_bytesz-urlretrieve_FileTests.test_reporthook_5_bytessHN	F,,X6""4#=#=k#Jj	*Va(1q)1q)rcg}|fd}|jddz}tjj|j	|t
j||jt|d|j|ddd|j|ddd|j|ddd|j|dddy)	Nc,|j|||fyr+rrs    rrzDurlretrieve_FileTests.test_reporthook_8193_bytes.<locals>.hooktester2rrxi rrr
i rrs    rtest_reporthook_8193_bytesz0urlretrieve_FileTests.test_reporthook_8193_bytes-sHN	F,,TD[9""4#=#=k#Jj	*Va(1t,1t,1t,1t,rN)r)rBrCrDrrrrrrrrrrrrr&rrrrs=20C (:*$%	**-rrceZdZdZdZdZy)urlretrieve_HttpTestsz5Test urllib.urlretrieve() using fake http connectionsc|jtjj|j	dd}|jtjj5	tjjtj||j	dddy#|jwxYw#1swYyxYw)NHTTP/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
cyr+r&)par1par2par3s   r_reporthookzYurlretrieve_HttpTests.test_short_content_raises_ContentTooShortError.<locals>._reporthookNsr)
reporthookrrrrrTrr@ContentTooShortErrorrr
TEST_HTTP_URLr\)r-rs  r.test_short_content_raises_ContentTooShortErrorzDurlretrieve_HttpTests.test_short_content_raises_ContentTooShortErrorAs112

		

v||@@
A	"
"**7+@+@6A+C!	"	"
!	"	"s$'C)/B2C2CCCc|jtjj|j	d|jtjj5	tjjtj|j	dddy#|jwxYw#1swYyxYw)NrrrAs rAtest_short_content_raises_ContentTooShortError_without_reporthookzWurlretrieve_HttpTests.test_short_content_raises_ContentTooShortError_without_reporthookXs112

	

v||@@
A	"
"**7+@+@A!		"	"!		"	"s$$C&-B-C-B??CCN)rBrCrDrrrr&rrrr>s?"."rrcFeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)QuotingTestsauTests 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
djgd}tjj|}|j	||d|d|tjj|}|j	||d|d|y)Nr)ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
0123456789z_.-~using quote():  != using quote_plus(): )joinrrrr
quote_plus)r-do_not_quoters   rtest_never_quotezQuotingTests.test_never_quotesuxx!)*##L1v6BFK	M((6v:FO	Qrcr|jtjjjddy)Nrr)rrrr__defaults__rAs rtest_default_safezQuotingTests.test_default_safes'++88;SArcd}tjj||}|j||d|d|tjj	||}|j||d|d|tjj|d}|j||d|d|tjjddd	
}tjjddd
}|j||d|d|tjjddd
}tjjddd
}|j||d|d|y)
Nz<>saferrrs<>uaüblatin-1ü)encodingrr)rrrrr)r-quote_by_defaultrexpects    r	test_safezQuotingTests.test_safes\##$4;K#L)66FO	Q(()9.>)@)6*F4	5##$45#A)66FO	Q##Hyv#N##Hyr#J &*	+##Hyw#O##Hyr#J &*	+rctdDcgc]
}t|}}|jd|jtddj|}|D]}tj
j
|}|jt||d|dt|d|tj
j|}|jt||d|d	t|d|~d
}d}tj
j
|}|j||d|d|tj
j|}|j||d|d|ycc}w)
N z
<>#%"{}|\^[]`rrrz should be escaped to z, not rz should be escapes to zab[]cdz
ab%5B%5Dcdr)
rrrrrrrrrr)r-numshould_quoterr
partial_quoteexpecteds       rtest_default_quotingz!QuotingTests.test_default_quotingsI-2"I6SC66,-CH%ww|, 
	>D\\''-FYt_f#IdOV=
>\\,,T2FYt_f#IdOV=
>
	>
 
##M266>G	I((76;CVL	N-7sE5c
@tjjd}|j|t	dd|dt	dtjjd}|j|dd|zd}|j
dt	d}tjj|}|j||d|d||j
dd}tjj|}|j||d|d|y)Nr+rr+zusing quote_plus(): %r != +z
a b cd e fr)rrrrrrr )r-rgivenr
s    rtest_quoting_spacezQuotingTests.test_quoting_spaces##C(36<inM	O((-6?	AsIcN3##E*6<fE	GsC(((/;A6J	Lrc|jtjjdd|jtjjddd|jtjjdd|jtjjdddy)Nzalpha+beta gammazalpha%2Bbeta+gammarzalpha+beta+gammasalpha+beta gamma+)rrrrrAs rtest_quoting_pluszQuotingTests.test_quoting_pluss001CD-	/001CSI+	-	
001DE-	/	
001CTJ+	-rcNd}d}tjj|}|j||d|d||j	t
tjj|dtjj
|}|j||d|d|y)Nab%A2%D8ab%FFrrrrzusing quote_from_bytes(): )rrrrr	TypeErrorquote_from_bytesr-rr
rs    rtest_quote_byteszQuotingTests.test_quote_bytess!##E*6<fE	G	
)V\\%7%7%.		0..u5"F,	-rcHd}d}tjj|}|j||d|d|tjj|dd}|j||d|d|d}d}tjj|d}|j||d|d|d	}d
}tjj|}|j||d|d|d	}|j	t
tjj|dd	}d}tjj|dd}|j||d|d|d	}d
}tjj|dd}|j||d|d|y)Nu¢Øabÿz%C2%A2%C3%98ab%C3%BFrrrerrorsrrr漢字%E6%BC%A2%E5%AD%97z%3F%3Fr z%26%2328450%3B%26%2323383%3Bxmlcharrefreplace)rrrrrrr s    rtest_quote_with_unicodez$QuotingTests.test_quote_with_unicodes '##E*6<fE	G##ED#F6<fE	G!##EI#>6<fE	G%##E*6<fE	G,fll.@.@%-6		8##EI+4$66<fE	G/##EI+>$@6<fE	Grcd}d}tjj|d}|j||d|d|d}d}tjj|dd	
}|j||d|d|y)Nu¢Ø ÿz
%A2%D8+%FFrrrruab漢字 cdzab%3F%3F+cdr r#)rrrrr s    rtest_quote_plus_with_unicodez)QuotingTests.test_quote_plus_with_unicode(s(((C;A6J	L$((09);;A6J	LrN)
rBrCrDrrrrrrrr!r(r*r&rrrrks;2QB+:N8L&
-- (GT
LrrcFeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)UnquotingTestszwTests for unquote() and unquote_plus()

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

    c	g}tdD]}tt|}t|}tjj|}|j
||d|d|tjj|}|j
||d|d||j|dj|}~tjj|}|j
|jddd|zy)	Nusing unquote(): rusing unquote_plus(): rrr
z/using unquote(): not all characters escaped: %s)rrrrrunquoterunquote_plusrrcount)r-escape_listrrr
r
escape_strings       rtest_unquotingzUnquotingTests.test_unquoting?s:
	&Cc#h'EXF\\))%0FVV<BFK
M\\..u5FVV$f.
/
u%
	&,
%%m4c*A &'	(rc|jttftjj
d|jttftjj
dy)Nr&)rrAttributeErrorrrr1rAs r#test_unquote_rejects_none_and_tuplez2UnquotingTests.test_unquote_rejects_none_and_tupleTsD9n5v||7K7KTR9n5v||7K7KRPrcd}|}tjj|}|j||d|d|d}|}tjj|}|j||d|d|d}|}tjj|}|j||d|d|d}t	|d}tjj|}|j||d|d|d}t	|d}tjj|}|j||d|d|d}t	|d}tjj|}|j||d|d||j
ttftjj
d|j
ttftjj
dy)	Nz%xabr/rz%xrrzusing unquote_to_bytes(): r&)	rrr1rr}unquote_to_bytesrrr8r s    rtest_unquoting_badpercentz(UnquotingTests.test_unquoting_badpercentXs%%e,"F*,	-%%e,"F*,	-%%e,"F*,	-ug&..u5"F*,	-ug&..u5"F*,	-ug&..u5"F*,	-9n5v||7T7TVZ[9n5v||7T7TVXYrc|d}d}tjj|}|j||d|d|y)Nz%Ab%eAsr;rrrr<rr s    rtest_unquoting_mixed_casez(UnquotingTests.test_unquoting_mixed_case|s<..u5"F,	-rcdtdz}d}tjj|}|j	||d|d|tjj|}|j	||d|d|y)Nzab%sdcabcdrrr0)rrrr1rr2r s    rtest_unquoting_partsz#UnquotingTests.test_unquoting_partssu)C.(%%e,6<fE	G**51=CVL	Nrcd}|}tjj|}|j||d|d||j	dd}tjj|}|j||d|d|y)Nzare+there+spaces...r/rrr+r0)rrr1rr r2r s    rtest_unquoting_plusz"UnquotingTests.test_unquoting_plussz%%%e,8>G	IsC(**51=CVL	Nrcd}d}tjj|}|j||d|d|tjjd}d}|j||d|d|d}d}tjj|}|j||d|d|d	}d}tjj|}|j||d|d|y)
N"br%C3%BCckner_sapporo_20050930.docsbrückner_sapporo_20050930.docr;r	漢%C3%BCs漢üs%A2%D8ab%FFrs	%A2ab%FFr?r s    rtest_unquote_to_bytesz$UnquotingTests.test_unquote_to_bytess48..u5"F,	-..~>("F,	-"..u5"F,	-
 "..u5"F,	-rc6d}d}tjj|}|j||d|d|tjj|dd}|j||d|d|tjjdd}d}|j||d|d|d	}d
}tjj|}|j||d|d|d}d}tjj|}|j||d|d|tjj|d
}|j||d|d|d}d}tjj|d}|j||d|d|tjjd}d}|j||d|d|tjjdd}d}|j||d|d|y)NrHubrückner_sapporo_20050930.docr/rr#zbr%FCckner_sapporo_20050930.docrrr&r%z%F3%B1u�r )r$rignorerIu漢üu漢%FCrrr1rr s    rtest_unquote_with_unicodez(UnquotingTests.test_unquote_with_unicodes45%%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%%n58>G	I
%%kI%F8>G	Ircld}d}tjj|}|j||d|d|d}d}tjj|}|j||d|d|d}d}tjj|}|j||d|d|y)	Nsblueberryjamblueberryjamr/rsblåbærsyltetøyublåbærsyltetøysbl%c3%a5b%c3%a6rsyltet%c3%b8jublåbærsyltetøjrMr s    rtest_unquoting_with_bytes_inputz.UnquotingTests.test_unquoting_with_bytes_inputs%%e,8>G	I70%%e,8>G	I10%%e,8>G	IrN)
rBrCrDrr6r9r=r@rDrFrJrNrQr&rrr,r,8s<(*Q"ZH-
N
N->8ItIrr,cXeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
Zy)urlencode_TestszTests for urlencode()cgd}tjj|}|D]}|j||d|d|d| |j	|jddd|d|jd|j
d}||dz
}||dz}|j|jxr|jd|d	||j	t|d
d|dt|dd
y
)aHelper 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.

        )z1st=1z2nd=2z3rd=3ztesting z: z not found in &rz: expected 2 '&'s; got r
z%: '&' not located in proper place in z#: unexpected number of characters: rN)
rr	urlencoderurr3indexrisdigitr)	r-r	test_typeexpect_somewhererramp_locationon_amp_lefton_amp_rights	         rhelp_inputtypezurlencode_Tests.help_inputtypes7''.(	8HMM(F#Xv7
8	8	
c*A#V\\#%68	9||C(\A-.lQ./++-H,2F2F2H)	*	
Vk$S[+?	@rc0|jdddddy)N123)1st2nd3rdzusing dict as input typer_rAs rtest_using_mappingz"urlencode_Tests.test_using_mapping0s3c=6	8rc,|jgddy)N))rdra)rerb)rfrcz*using sequence of two-item tuples as inputrgrAs rtest_using_sequencez#urlencode_Tests.test_using_sequence5sFH	Jrcddi}tddtd}tjj|}|j	||ddi}d}tjj|}|j	||y)NrU=zkey namezA bunch of pluseszkey+name=A+bunch+of+pluses)rrrrWrr s    rtest_quotingzurlencode_Tests.test_quoting:suS	%cNIcN;''.(/0-''.(rcdgdi}dtjjtgdz}tjj	|}|j||tjj	|d}|dD]}d|z}|j
|||j|jddd|jdzy)Nsequence)rarbrczsequence=%sTrUrzExpected 2 '&'s, got %s)rrrrrWrrur3)r-rr
rvalues     r
test_doseqzurlencode_Tests.test_doseqEsO,!8!8_9M!NN''.(''t4:&	*E"U*FMM&&)	*	
c*A2V\\#5FF	Hrc|jdtjji|jdtjjgyr|rrrrWrAs rtest_empty_sequencez#urlencode_Tests.test_empty_sequenceRs@V\\33B78V\\33B78rc|jdtjjddi|jdtjjddiy)Nza=1ar
za=NonersrAs rtest_nonstring_valuesz%urlencode_Tests.test_nonstring_valuesVsH 6 6Qx @A6<<#9#93+#FGrcf|jdtjjdddgid|jdtjjdddgidt	j
ddg}|jd	tjjd|idy)
Nza=1&a=2rvr
rTz
a=None&a=a)rvr
)br
za=a&a=b)rrrrWrr)r-r s  rtest_nonstring_seq_valuesz)urlencode_Tests.test_nonstring_seq_valuesZsFLL$:$:C!Q=$$OP//tSk0BDI	K&&(';<//dTB	DrcLd}d}tjj|dd}|j||d}d}tjj|}|j||d}d}tjj|d	}|j||y)
N) Á%3F=%3Frqr r#
%C2%A0=%C3%81%A0=%C1rrrrrWrr s    rtest_urlencode_encodingz'urlencode_Tests.test_urlencode_encodingbs'''	'R(( ''.((''	'B(rcd}d}tjj|ddd}|j||d}d}tjj|ddd	}|j||d}d
}tjj|d}|j||d}d}tjj|d}|j||d}d
}tjj|dd}|j||d}d}tjj|dd}|j||y)Nr|rTrqr )doseqrr$))r})r
r~z
%3F=1&%3F=%3Fr#r))r})*r~z%C2%A0=42&%C2%A0=%C3%81rrrz%A0=42&%A0=%C1rr s    rtest_urlencode_encoding_doseqz-urlencode_Tests.test_urlencode_encoding_dosequsL'''T18(L(- ''t18(L(( ''t4(-*''t4((''ti'H(-!''ti'H(rc>d}d}tjj|}|j||tjj|d}|j||d}d}tjj|d}|j||y)N)$$z
%A0%24=%C1%24T))r)rrz%A0%24=42&%A0%24=%C1%24rr s    rtest_urlencode_bytesz$urlencode_Tests.test_urlencode_bytess- ''.(''t4(4*''t4(rcd}tjj|d}d}|j||d}tjj|dd}d}|j||d}d}tjj|dd}|j||d}tjj|dd	
}d}|j||d}d}tjj|ddd	}d}d}tjj|ddd	
}|j||y)Nrz:$rz	%A0$=%C1$T)rr))r)r
rz%A0$=%C1$&%A0$=13&%A0$=42r)rr)rrrr)r-rrr
s    r&test_urlencode_encoding_safe_parameterz6urlencode_Tests.test_urlencode_encoding_safe_parametersI
.''D'9(-''T'E(9,''t$'?(.''D1:(<(-''T1:(<9,''t$1:(<(rN)rBrCrDrr_rhrjrmrqrtrwrzrrrrr&rrrSrS
sH@@8
J
	)H9HD)&#)J)&)rrSceZdZdZdZdZejejdk(ddZ
ejejdk(ddZy	)
Pathname_Testsz&Test pathname2url() and url2pathname()c,tjjdddd}d}tjj|}|j
||d|d|tjj|}|j
||d|d|y)	NpartsofrvrWzparts/of/a/pathpathname2url() failed; rzurl2pathame() failed; )rrWrrrr	rr)r-
expected_pathexpected_urlrs    rrzPathname_Tests.test_basicsWdC@
(,,];v ,0	1,,\: -1	2rctjjddd}dtjjdz}tjj|}|j||d|d||}tjj|}|j||d|d|tjjdd	}d
tjjdz}tjj|}|j||d|d|d}tjjdd
}tjj|}|j||d|d|y)Nneedszquot=ingherez
needs/%s/hererrzurl2pathname() failed; z	make sureusing_quotez%s/using_quotezmake+sure/using_unquotez	make+sure
using_unquote)
rrWrrrrrr	rrr s    rrmzPathname_Tests.test_quotingsDWj&9 6<<#5#5j#AA,,U3 &*	+,,V4 &*	+[-8!FLL$6$6{$CC,,U3 &*	+*k?;,,U3 &*	+rwin32z*test specific to the nturl2path functions.cd}d}tjj|}|j||d|d|d}d}tjj|}|j||d|d|y)Nz
\\?\C:\dirz	///C:/dirrrz\\?\unc\server\share\dirz/server/share/dir)rrr	rr s    r
test_prefixeszPathname_Tests.test_prefixessz!,,U3 &*	+1$,,U3 &*	+rz.test specific to the urllib.url2path function.c	d}d}|D]:}tjj|}|j||d|d|<d}d}tjj|}|j||d|d|y)N)z/C:/z///C:/z/C|//C:\z'urllib.request..url2pathname() failed; rz
///C|/pathzC:\pathz&urllib.request.url2pathname() failed; )rrrr)r-rr
rrs     rtest_ntpathzPathname_Tests.test_ntpath
s,	/C^^005FVV$f.
/	/
,,U3 &*	+rN)rBrCrDrrrmrrsysplatformrrr&rrrrsq02+6X0EG
+G
+ X0IK
+K
+rrceZdZdZdZy)
Utility_Testsz=Testcase to test the various utility functions in the urllib.ch|jtjjty)zATest the urllib.request.thishost utility function returns a tupleN)rrrthishosttuplerAs r
test_thishostzUtility_Tests.test_thishost!sfnn557?rN)rBrCrDrrr&rrrrsG@rrceZdZdZdZejedZejedZ	ejedZ
y)URLopener_Testsz4Testcase to test the open method of URLopener class.cBGddtjj}tjdt
f5|j
|jdd|j
|jdddddy#1swYyxYw)NceZdZdZy)8URLopener_Tests.test_quoted_open.<locals>.DummyURLopenerc|Sr+r&r-rs  r	open_spamzBURLopener_Tests.test_quoted_open.<locals>.DummyURLopener.open_spam+
rN)rBrCrDrr&rrDummyURLopenerr*
rrz8DummyURLopener style of invoking requests is deprecated.zspam://example/ /z//example/%20/z,spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/z'//c:|windows%/:=&?~#+!$,;'@()*[]|/path/)rrr}rr$r%rr)r-rs  rtest_quoted_openz URLopener_Tests.test_quoted_open)s	V^^55	
+
+K"$%		;
^-22#%%5
7
^-22>@9
;		;		;		;sA
BB)categoryctj5}tj|\}}t	j
|dtjj|z}tjjj|\}}|jtjj|tjj|dddy#1swYyxYw)N)dirzfile:)rtemp_dirrUrVrr@rrr	r}retrieverrWnormcase)r-tmpdirr[tmpfilefileurlrN_s       rtest_urlopener_retrieve_filez,URLopener_Tests.test_urlopener_retrieve_file8s



!	TV"**v6KBHHRL ; ;G DDG ..224==gFKHaRWW--h79I9I'9RS
	T	T	TsC
C++C4c$d}|jd|j|jtjjj
|\}}|jtjj|ddy)Nzhttp://www.python.org/file.txtrr
z.txt)rTrr\rrr}rrrrWsplitext)r-rrNrs    rtest_urlopener_retrieve_remotez.URLopener_Tests.test_urlopener_retrieve_remoteBsi.

67(nn..099#>!))(3A6?rcBGddtjj}dD]}|jttjj
||jttjjj||jttjjj||jt|j||jt|j|y)NceZdZdZy)<URLopener_Tests.test_local_file_open.<locals>.DummyURLopenerc|Sr+r&rs  ropen_local_filezLURLopener_Tests.test_local_file_open.<locals>.DummyURLopener.open_local_fileNrrN)rBrCrDrr&rrrrMrrr)zlocal_file://examplezlocal-file://example)rrr}rr=r"rr)r-rrs   rtest_local_file_openz$URLopener_Tests.test_local_file_openJs	V^^55	D	GCgv~~'='=sCgv~~'?'?'A'F'FLgv~~'?'?'A'J'JCPg~'7'<'<cBg~'7'@'@#F	GrN)rBrCrDrrrignore_warningsr%rrrr&rrrr&sy>
;%_$$.@ATBT%_$$.@A@B@%_$$.@A
GB
GrrceZdZdZdZdZy)RequestTestsz&Unit tests for urllib.request.Request.ctjj}|d}|j|j	d|di}|j|j	dy)NrrPOST)rrRequestr
get_methodr-rrs   rtest_default_valuesz RequestTests.test_default_values[s[..((12++-u5126++-v6rctjj}|dd}|j|jd|j|jd|did}|j|jd|j|jd|dd}|j|jdd|_|j|jdy)NrHEAD)methodr)rrrrrrrs   rtest_with_method_argz!RequestTests.test_with_method_argbs..((1&A0++-v612fE0++-v61%@++-u5++-v6rN)rBrCrDrrrr&rrrrXs077rrc*eZdZdZdZdZdZdZy)URL2PathNameTestsc|jtdd|jtdd|jtddy)Nz///C|C:///C:z///C|/rrrrAs rtest_converting_drive_letterz.URL2PathNameTests.test_converting_drive_letterrsAg.5g.5h/8rcp|jtdd|jtddy)Nz
///C/test/z
\\\C\test\z////C/test/z	\\C\test\rrAs r$test_converting_when_no_drive_letterz6URL2PathNameTests.test_converting_when_no_drive_letterws.l35FGm46FGrc:|jtddy)Nz///C|/foo/bar/spam.fooC:\foo\bar\spam.foorrAs rtest_simple_comparez%URL2PathNameTests.test_simple_compare|s&>?/	1rc:|jttdy)Nu///è|/)rIOErrorrrAs rtest_non_ascii_drive_letterz-URL2PathNameTests.test_non_ascii_drive_letters'<?rcbgd}|D]&}|jtt||(y)N)rz\\\C\test\\r)rrr	r-
list_of_pathsrWs   rtest_roundtrip_url2pathnamez-URL2PathNameTests.test_roundtrip_url2pathnames6
"	ED\,t*<=tD	ErN)rBrCrDrrrrrr&rrrrps9
H
1@Errc*eZdZdZdZdZdZdZy)PathName2URLTestscp|jtdd|jtddy)Nrrrrr	rAs rrz.PathName2URLTests.test_converting_drive_letters,d+W5f-w7rc|jtdd|jtdd|jtddy)Nz\\\folder\test\/////folder/test/z\\folder\test\z////folder/test/z
\folder\test\z
/folder/test/rrAs rrz6PathName2URLTests.test_converting_when_no_drive_lettersM&<=,	.&;<+	-&:;(	*rc:|jtddy)Nr///C:/foo/bar/spam.foorrAs rrz%PathName2URLTests.test_simple_compares&<=1	4rc:|jttdy)NzXX:\)rrr	rAs rtest_long_drive_letterz(PathName2URLTests.test_long_drive_letters'<9rcbgd}|D]&}|jtt||(y)N)rrr)rr	rrs   rtest_roundtrip_pathname2urlz-PathName2URLTests.test_roundtrip_pathname2urls63
"	ED\,t*<=tD	ErN)rBrCrDrrrrrr&rrrrs8*4:Err__main__)NNr]);rurllib.parserurllib.requesturllib.errorhttp.clientrQ
email.messagerr8r
unittest.mockrrjrtest.supportrrrrrImportErrorrrU
nturl2pathrr	base64r
rhas_gethostnamerrrr"rrTrqrVr_TestCaserxrrrrrrrr,rSrrrrrrrBmainr&rr<module>rs$A	"&(	1$$
(

9
::

& /,^<F<;6;(ZR))ZRzD9""D9N!C 1 1!CHH))=,HVJP))JPZL-H--L-^*"H--}*"ZJL8$$JLZRIX&&RIjA)h''A)FL+X&&L+\@H%%@/GmX%6%6/Gd78$$70E))E6E))E8zHMMOk4
CsHHH