python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_urllibnet.cpython-311.pyc

e%*ddlZddlmZddlmZddlmZddlZddlZddlZ	ddl
Z	ddlZddlZ
ddlZejdGddejZGdd	ejZGd
dejZedkrejdSdS)
N)support)	os_helper)
socket_helpernetworkc eZdZdZdZdZdS)URLTimeoutTestcBtjtjdSN)socketsetdefaulttimeoutrINTERNET_TIMEOUTselfs G/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_urllibnet.pysetUpzURLTimeoutTest.setUps !9:::::c.tjddSr
)rrrs rtearDownzURLTimeoutTest.tearDowns &&&&&rc~|tjjtjtjj}tj
|5tjtj}|ddddS#1swxYwYdSr
)
addCleanupurllibrequest
urlcleanupparseurlparser
TEST_HTTP_URLnetlocrtransient_interneturlopenread)rdomainfs   rtestURLreadzURLTimeoutTest.testURLreads1222&&w'<==D

-f
5
5		&&w'<==A
FFHHH																		s'>B22B69B6N)__name__
__module____qualname__rrr#rrrrsA;;;'''rrceZdZdZdZdZejdZdZ	dZ
dZdZd	Z
ejd
dZdS)
urlopenNetworkTestsaATests urllib.request.urlopen using the network.

    These tests are not exhaustive.  Assuming that testing using files does a
    good job overall of some of the basic interface features.  There are no
    tests exercising the optional 'data' and 'proxies' arguments.  No tests
    for transparent redirection have been written.

    setUp is not used for always constructing a connection to
    http://www.pythontest.net/ since there a few tests that don't use that address
    and making a connection is expensive enough to warrant minimizing unneeded
    connections.

    http://www.pythontest.net/cN|tjjdSr
rrrrrs rrzurlopenNetworkTests.setUp6122222rc/K|d}tj|5tjj|i|}	|V|n#|wxYw	ddddS#1swxYwYdSNr)rrrrrclose)rargskwargsresourcers     rrzurlopenNetworkTests.urlopen:s7

-h
7
7		&777A
																											s'A7AA7A&&A77A;>A;c||j5}dD])}|t||d|z*||dddddS#1swxYwYdS)N)r readline	readlinesfilenor0infogeturlz3object returned from urlopen lacks the %s attributezcalling 'read' failed)rurl
assertTruehasattrr )ropen_urlattrs   r
test_basiczurlopenNetworkTests.test_basicDs
\\$(
#
#	Fx+
I
I$ 7 7:ACG:HIIIIOOHMMOO-DEEE	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	FsAA==BBc$||j5}||td||tdddddS#1swxYwYdS)Nz readline did not return a stringzreadlines did not return a list)rr;assertIsInstancer6bytesr7list)rr>s  rtest_readlinesz"urlopenNetworkTests.test_readlinesMs
\\$(
#
#	Ex!!("3"3"5"5u"D
F
F
F!!("4"4"6"6"C
E
E
E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	EsABB	B	c0||j5}|}||tjjd||dddddS#1swxYwYdS)NzEobject returned by 'info' is not an instance of email.message.Messagehtml)	rr;r9rBemailmessageMessageassertEqualget_content_subtype)rr>info_objs   r	test_infozurlopenNetworkTests.test_infoUs
\\$(
#
#	Ex}}H!!(EM,A#F
G
G
G
X99;;VDDD	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	E	EsA#BBBc||j5}|}|||jddddS#1swxYwYdSr
)rr;r:rK)rr>
gotten_urls   rtest_geturlzurlopenNetworkTests.test_geturl^s
\\$(
#
#	3x!**JZ222	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3s0AAAc|jdz}tj|5|t5t
j|}dddn#1swxYwY	|	}|
n#|
wxYw||dddddS#1swxYwYdS)N
XXXinvalidXXXi)r;rrassertWarnsDeprecationWarningrrFancyURLopeneropengetcoder0rK)rURLr>codes    rtest_getcodez urlopenNetworkTests.test_getcodedsth(

-c
2
2	(	(!!"455
E
E!>88::??DD
E
E
E
E
E
E
E
E
E
E
E
E
E
E
E
!''))        T3'''	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(	(sLC)2A8,C)8A<	<C)?A<	C)B-C)-CC))C-0C-walltimecXd}	tj||d|zn#t$rYnwxYwd}|t|5t
jd|ddddS#1swxYwYdS)Nzsadflkjsasf.i.nvali.d.z&%r should not resolve for test to workzuopening an invalid URL did not raise OSError; can be caused by a broken DNS server (e.g. returns 404 or hijacks page)msgz
http://{}/)	r
gethostbynameskipTestOSErrorassertRaisesrrrformat)rbogus_domainfailure_explanations   rtest_bad_addressz$urlopenNetworkTests.test_bad_addressps",0		S ...
MMB\QRRRR			
D		 D

w,?

@
@	F	FN""<#6#6|#D#DEEE	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	Fs1
>>3BB#&B#N)r$r%r&__doc__r;r
contextlibcontextmanagerrr@rErNrQr[rrequires_resourcergr'rrr)r)%s'C333FFFEEEEEE333
(
(
(Wz**$F$F+*$F$F$Frr)ceZdZdZdZejdZdZdZ	dZ
dZej
dd	Zd
ZdS)urlretrieveNetworkTestsz3Tests urllib.request.urlretrieve using the network.cN|tjjdSr
r,rs rrzurlretrieveNetworkTests.setUpr-rc/K|d}tj|5tjj|i|\}}	||fVtj|n#tj|wxYw	ddddS#1swxYwYdSr/)rrrrurlretrieverunlink)rr1r2r3
file_locationr9s      rrpz#urlretrieveNetworkTests.urlretrieves7

-h
7
7	0	0"(."<d"Mf"M"MM4
0#T)))) ////	 /////	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0s(A<AA<A++A<<BBcx||j5\}}|tj|dt
|d5}||ddddn#1swxYwYddddS#1swxYwYdS)Nz9file location returned by urlretrieve is not a valid pathrbz=reading from the file location returned by urlretrieve failed)rplogor<ospathexistsrWr rrrr9r"s    rr@z"urlretrieveNetworkTests.test_basics3


di
(
(	:,A]DOOBGNN=99<?
@
@
@mT**
:a+9:::
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:	:s6AB/")BB/B	B/B	B//B36B3c||jtj5\}}||tj|tj|t|d5}||
ddddn#1swxYwYddddS#1swxYwYdS)Nrtz"reading from temporary file failed)rprurTESTFNrKr<rvrwrxrWr rys    rtest_specified_pathz+urlretrieveNetworkTests.test_specified_pathsc


di'.00	P3HM4]I,<===OOBGNN=99:::mT**
Pa*NOOO
P
P
P
P
P
P
P
P
P
P
P
P
P
P
P		P	P	P	P	P	P	P	P	P	P	P	P	P	P	P	P	P	Ps6A&C)C5CC	CC		CC Cc||j5\}}||tjjdddddS#1swxYwYdS)Nz0info is not an instance of email.message.Message)rprurBrHrIrJ)rrrr9s   rtest_headerz#urlretrieveNetworkTests.test_headers


di
(
(	V,A]D!!$
(="T
V
V
V	V	V	V	V	V	V	V	V	V	V	V	V	V	V	V	V	V	Vs*AAAr*r\c||j5\}}|d}d}	tj||n(#t
$r|d|zYnwxYwddddS#1swxYwYdS)NDatez%a, %d %b %Y %H:%M:%S GMTzDate value not in %r format)rprugettimestrptime
ValueErrorfail)rrrfileheaders	datevalue
dateformats     rtest_data_headerz(urlretrieveNetworkTests.test_data_headers


di
(
(	F,H]K#//I4J
F
i4444
F
F
F		7*DEEEEE
F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	F	Fs4BA
B
"A2/B1A22BB	Bcgfd}||j|5\}}t|d}dddn#1swxYwYt}|tdd|ddd|dddd|z|dd	||d
d	|dD}|ddh|d|z|d
dddz|d
|zdS)Nc8|||fdSr
)append)blocks
block_size
total_sizerecordss   rrecording_reporthookzEurlretrieveNetworkTests.test_reporthook.<locals>.recording_reporthooks"NNFJ
;<<<<<r)
reporthookzContent-LengthzKThere should always be two calls; the first one before the transfer starts.r^rzblock size can't be 0 in %sch|]\}}}|	Sr'r').0_rs   r	<setcomp>z:urlretrieveNetworkTests.test_reporthook.<locals>.<setcomp>sBBB&6aQzBBBrzblock sizes in %s must be equalz9number of blocks * block size must be >= total size in %s)rpruintrepr
assertGreaterlenrKassertGreaterEqual)rrrrr
expected_sizerecords_reprblock_sizesrs       @rtest_reporthookz'urlretrieveNetworkTests.test_reporthooks	=	=	=	=	=

di4H

I
I	?N,{,< =>>M	?	?	?	?	?	?	?	?	?	?	?	?	?	?	?G}}3w<<1N	O	O	OA***71:a=!<|K		M	M	MA
666Q777BB'BBB'!*Q-+>M		O	O	OAwqz!} <m%79E%F	 	G	G	G	G	GsA

AAN)r$r%r&rhrrirjrpr@r|r~rurrkrrr'rrrmrms==333000:::PPPVVV(DWz**FF+*FGGGGGrrm__main__)unittesttestrtest.supportrrrirurllib.parserurllib.requestrv
email.messagerHrrequiresTestCaserr)rmr$mainr'rr<module>rss""""""&&&&&&



				X&&pFpFpFpFpF(+pFpFpFfMGMGMGMGMGh/MGMGMG`zHMOOOOOr