python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_urllib2net.cpython-312.opt-2.pyc

Αe7nddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddl
Z
ddlZddlZ
ddlZ
ddlZej ddZd	Zee
j&j(e
j*j,ZGd
deZeeej6Zeeej:Zeeej:ZGd
dej@Z!Gddej@Z"Gddej@Z#Gddej@Z$e%dk(rejLyy)N)support)	os_helper)
socket_helper)ResourceDenied)sanepathname2urlnetworkcbtdD]}	||i|cS#|$r}|}Yd}~d}~wwxYw)N)range)funcexcargskwargsielast_excs       H/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_urllib2net.py
_retry_thricersK
1X	(((N	H	s.).cfd}|S)Nc$tg|i|SN)r)rrr
rs  rwrappedz(_wrap_with_retry_thrice.<locals>.wrappedsT38888)rr
rs`` r_wrap_with_retry_thricers
9Nrc"eZdZ	dZdZddZy)TransientResourcec ||_||_yr)r
attrs)selfr
rs   r__init__zTransientResource.__init__+s
rc|Srrr s r	__enter__zTransientResource.__enter__/srNc	|ct|j|rL|jjD]$\}}t	||syt|||k7s$yt
dyy)Nz%an optional resource is not available)
issubclassr
ritemshasattrgetattrr)r type_value	tracebackattr
attr_values      r__exit__zTransientResource.__exit__2st	DHHe!<$(JJ$4$4$6
N jud+5$':5	
N%%LMM"=r)NNN)__name__
__module____qualname__r!r$r/rrrrr&sINrr)errnoceZdZy)	AuthTestsN)r0r1r2rrrr5r5Gs0rr5ceZdZdZy)CloseSocketTestc|jtjjtj
}t
j|5t|}|j}|j|j|j|j|jdddy#1swYyxYwr)
addCleanupurllibrequest
urlcleanupr
TEST_HTTP_URLrtransient_internet_urlopen_with_retryfpassertFalseclosedclose
assertTrue)r urlresponsesocks    r
test_closezCloseSocketTest.test_closeps112##

-
-c
2	)*3/H;;DT[[)NNOODKK(	)	)	)s
AB66B?N)r0r1r2rHrrrr7r7ns)rr7ceZdZdZej
ddZdZdZej
ddZ	dZ
ejdd	Z
d
d
ZdZy)OtherNetworkTestscyr)logging	getLogger
addHandler
StreamHandler)r rLloggers   rsetUpzOtherNetworkTests.setUpsrwalltimecddddtjjfg}|j||j	y)Nzftp://www.pythontest.net/READMEz*ftp://www.pythontest.net/non-existent-file)r:errorURLError
_test_urls_extra_handlers)r urlss  rtest_ftpzOtherNetworkTests.test_ftpsA
.-
9
6<<((
*	
d2245rctj}t|d}	|jd|j	dttjj|zddtjjfg}|j||jdt
j||jt tj"j$dy#t
j|wxYw)Nwz	hi there
zfile:zfile:///nonsensename/etc/passwdT)retryz./relative_path/to/file)rTESTFNopenwriterCrospathabspathr:rTrUrVrWremoveassertRaises
ValueErrorr;urlopen)r r]frXs    r	test_filezOtherNetworkTests.test_files!!
	
GGL!
GGI*277??6+BCC2D&&(D

OOD$"6"6"8OEIIf*fnn&<&<=VW
IIfsBC..Dcd}tj|5tjj	|}tjj|}|j
|jddddy#1swYyxYw)Nz)http://www.pythontest.net/index.html#fragrr>r:r;RequestrfassertEqualgeturl)r urlwith_fragreqress    rtest_urlwithfragz"OtherNetworkTests.test_urlwithfragspB

-
-l
;	A..((6C..((-CSZZ\?
A	A	A	AABB	cd}tj|5tjj	|}tjj|}|j
|jddddy#1swYyxYw)Nz*http://www.pythontest.net/redir/with_frag/z)http://www.pythontest.net/elsewhere/#fragrj)r redirect_url_with_fragrorps    rtest_redirect_url_withfragz,OtherNetworkTests.test_redirect_url_withfragss!M

-
-.D
E	A..(()?@C..((-CSZZ\?
A	A	A	ArrcXtj}tj|5tj
j
}tj
j|}|j|j|j||j|j|j|jd|jdd|j||j|jdddddy#1swYyxYw)Nz
User-agentz
User-Agentz
Test-Agent)rr=rr>r:r;build_openerrkrAheader_itemsr^rD
has_header
add_headerrl
get_header)r rEopenerr;s    rtest_custom_headersz%OtherNetworkTests.test_custom_headerss##

-
-c
2		L^^002Fnn,,S1GW1134KK OOG0023OOG..|<=|L9KK W//=lK		L		L		LsC1D  D)z XXX: http://www.imdb.com is gonecd}tj|5	tjj	|5}	ddd|jtjj	|}|j}|j|dddy#1swYcxYw#t$r|jdYqwxYw#1swYyxYw)Nzhttp://www.imdb.comzOurlopen failed for site not sending                            Connection:close)	rr>r:r;rfrDrefailread)r URLrpros    rtest_sites_no_connection_closez0OtherNetworkTests.test_sites_no_connection_closes
$

-
-c
2	!
%^^++C0C$..((-C((*COOC 	!	!
.		-.
.		!	!sEC	B)BB)AC	B&	"B))CC	CC		Ccddl}ddl}|jdj}t	j
j|j}|r$t|tjj}|D]}|j|5t|tr|\}}	}
ndx}	}
tj|5	|||	t j"}	t$5t&5t(5|j+}|dt-|zddddddddd|j7ddd|j?ddddy#1swYMxYw#1swYQxYw#1swYUxYw#t.$r!t1d|zt2j4YwxYw#t8$r;}
|
r.d|
d|d	|	d
t;|
d|

}|j=|
|
|nYd}
~
d}
~
wwxYw#1swYxYw#1swYxYw)
Nrtest_urllib2)rEz
read %d bytesz
<timeout: %s>)filezDidn't get expected error(s) z for  z, got z: g?) timerLrMdebugr:r;rwr^rrTrUsubTest
isinstancetuplerr>rINTERNET_TIMEOUTtime_outsocket_peer_resetioerror_peer_resetrlenTimeoutErrorprintsysstderrrCOSErrortypeassertIsInstancesleep)r rXhandlersr\rrLrrfrEroexpected_errrgbuferrmsgs               rrVzOtherNetworkTests._test_urlss!!.177..--x8==-gv||7L7LMG	 C#&
 c5)-0*Cl)--C,"55c:""#Cg.F.FGJ!)B!2B!3B'(ffh %oC&@ A	BBB	)"*

37
 
 	 (BBBBBB
 ,J!/C"7cjjIJ#"'$0#sDIs$LC 11#|SI!J	"	""

 
 s1G<8G0:F)E<E0	 E$'%E
E$E0	E<$G04G<E!E$$E-)E0	0E9
5E<<'F&	#G0%F&	&G0)	G-	21G(	#G0(G-	-G00G95G<<H	cg}tjj}|j|j|jd|j
||S)N)r:r;CacheFTPHandlerr9clear_cache
setTimeoutappend)r rcfhs   rrWz!OtherNetworkTests._extra_handlerssFnn,,.(qrN)T)r0r1r2rQrrequires_resourcerYrhrqrur}unittestskiprrVrWrrrrJrJ~s7Wz*6+6XZAWz*A+ALX]]56!7!(% NrrJceZdZdZdZdZdZdZdZe	jddZd	Ze	jdd
Z
e	jddZy)
TimeoutTestcV|jtjjyr)r9r:r;r<r#s rrQzTimeoutTest.setUp&s112rc|jtjtj}tj|d5t|}|j|j|j|jjjjdddy#1swYyxYwNtimeout)assertIsNonesocketgetdefaulttimeoutrr=rr>r?r9rCr@raw_sock
gettimeoutr rEus   rtest_http_basiczTimeoutTest.test_http_basic*s&2245##

-
-c4
@	;#C(AOOAGG$addhhnn779:	;	;	;s
A$B88Cc|jtjtj}tj|5tjd	t|}|j|jtjd|j|jjjjddddy#tjdwxYw#1swYyxYwN<)rrrrr=rr>setdefaulttimeoutr?r9rCrlr@rrrrs   rtest_http_default_timeoutz%TimeoutTest.test_http_default_timeout2s&2245##

-
-c
2	>$$R(
/',(((.QTTXX^^668"=	>	>((.
	>	>s%	C< &C"AC<"C99C<<Dc|jtjtj}tj|5tjd	t|d}|j|jtjd|j|jjjjdddy#tjdwxYw#1swYyxYwNrr)rrrrr=rr>rr?r9rCr@rrrrs   rtest_http_no_timeoutz TimeoutTest.test_http_no_timeout>s&2245##

-
-c
2	;$$R(
/'T:(((.addhhnn779:	;	;((.
	;	;s%	C= (C#AC=#C::C==DcDtj}tj|5t	|d}|j|j|j|jjjjddddy#1swYyxYw)Nxr)rr=rr>r?r9rCrlr@rrrrs   rtest_http_timeoutzTimeoutTest.test_http_timeoutJsq##

-
-c
2	?#C5AOOAGG$QTTXX^^668#>	?	?	?sA'BBzftp://www.pythontest.net/rRc|jtjtj|j
d5t
|j
}|j|j|j|jjjjjdddy#1swYyxYwr)
rrrrr>FTP_HOSTr?r9rCr@rrrr rs  rtest_ftp_basiczTimeoutTest.test_ftp_basicSs&2245

-
-dmmT
J	>#DMM2AOOAGG$addggkk//::<=	>	>	>s
A8CCc,|jtjtj|j
5tjd	t|j
}|j|jtjd|j|jjjjjddddy#tjdwxYw#1swYyxYwr)rrrrr>rrr?r9rCrlr@rrrrs  rtest_ftp_default_timeoutz$TimeoutTest.test_ftp_default_timeout[s&2245

-
-dmm
<	A$$R(
/'

6(((.QTTWW[[..99;R@	A	A((.
	A	As%D
0C0
AD
0DD

Dc.|jtjtj|j
5tjd	t|j
d}|j|jtjd|j|jjjjjdddy#tjdwxYw#1swYyxYwr)rrrrr>rrr?r9rCr@rrrrs  rtest_ftp_no_timeoutzTimeoutTest.test_ftp_no_timeoutfs&2245

-
-dmm
<	>$$R(
/'

tD(((.addggkk//::<=	>	>((.
	>	>s%D2C1AD1DDDc`tj|j5t|jd}|j	|j
|j
|jjjjjddddy#1swYyxYwr)rr>rr?r9rCrlr@rrrrs  rtest_ftp_timeoutzTimeoutTest.test_ftp_timeoutrsx

-
-dmm
<	A#DMM2>AOOAGG$QTTWW[[..99;R@	A	A	AsA;B$$B-N)r0r1r2rQrrrrrrrrrrrrrrrr%s3;
>
;?+HWz*>+>	AWz*	>+	>Wz*A+Arr__main__)'r3rtestrtest.supportrrrtest.test_urllib2rr`rurllib.errorr:urllib.requestrrequiresrrr;rfrTrUr?objectrr	ETIMEDOUTr
ECONNRESETrrTestCaser5r7rJrr0mainrrr<module>rs"&'.	

.fnn.D.D.4ll.C.CENN8WEOO<%gU5E5EF&we6F6FG1!!1N)h'') d))dNRA(##RAjzHMMOr