Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.145.48.63
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_urllibnet.pyo
�
@��cc@s�ddlZddlmZddlmZddlZddlZddlZddlZddl	Z	yddl
Z
Wnek
r�dZ
nXej
je�Zej
jed�Zejdde�Zd�Zdejfd	��YZd
ejfd��YZdejfd
��YZeje
dkd�dejfd��Y�Zdejfd��YZd�Zedkr�e�ndS(i����N(ttest_support(tskip_ftp_test_on_travissselfsigned_pythontestdotnet.pemt	mimetoolst
deprecatedcOsWxJtd�D]<}y||||�SWq
tk
r?}q
q
�q
Xq
W|�dS(Ni(trangetIOError(tfuncthosttargstkwargstitlast_exc((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyt_open_with_retrystURLTimeoutTestcBs)eZdZd�Zd�Zd�ZRS(g$@cCstj|j�dS(N(tsockettsetdefaulttimeouttTIMEOUT(tself((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pytsetUp(scCstjd�dS(N(RRtNone(R((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttearDown+scCs%ttjtj�}|j�}dS(N(RturllibturlopenRt
TEST_HTTP_URLtread(Rtftx((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttestURLread.s(t__name__t
__module__RRRR(((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyR
$s		turlopenNetworkTestscBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Ze	j
ejd
kd�e	j
eed	�d
�d���Zd�ZRS(s6Tests urllib.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.example.com/ since there a few tests that don't use that address
    and making a connection is expensive enough to warrant minimizing unneeded
    connections.

    cGsttj|�S(N(RRR(RR((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyRAscCsl|jtj�}x+d
D]#}|jt||�d|�qWz|j|j�d	�Wd|j�XdS(NRtreadlinet	readlinestfilenotclosetinfotgeturls3object returned from urlopen lacks the %s attributescalling 'read' failed(RRR R!R"R#R$(RRRt
assertTruethasattrRR"(Rtopen_urltattr((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyt
test_basicDs
cCsZ|jtj�}z6|j|j�td�|j|j�td�Wd|j�XdS(Ns readline did not return a stringsreadlines did not return a list(	RRRtassertIsInstanceRt
basestringR tlistR"(RR'((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_readlinesPscCs`|jtj�}z|j�}Wd|j�|j|tjd�|j|j	�d�XdS(NsAobject returned by 'info' is not an instance of mimetools.Messagethtml(
RRRR#R"R*RtMessagetassertEqualt
getsubtype(RR'tinfo_obj((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyt	test_info[s
cCsG|jtj�}z|j�}Wd|j�X|j|tj�dS(N(RRRR$R"R0(RR't
gotten_url((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_geturlgs
cCsMd}tj�j|�}z|j�}Wd|j�X|j|d�dS(Ns'http://www.pythontest.net/XXXinvalidXXXi�(RtFancyURLopenertopentgetcodeR"R0(RtURLR'tcode((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_getcodepstwin32snot appropriate for Windowstfdopensos.fdopen not availablecCsY|jtj�}|j�}tj|�}z|j|j�d�Wd|j�XdS(Ns<reading from file created using fd returned by fileno failed(	RRRR!tosR=R%RR"(RR'tfdtFILE((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_filenozscCsYd}ytj|�Wntjk
r-nX|jd|�|jttjd�dS(Nssadflkjsasf.i.nvali.ds&%r should not resolve for test to workshttp://sadflkjsasf.i.nvali.d/(Rt
gethostbynametgaierrortskipTesttassertRaisesRRR(Rtbogus_domain((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_bad_address�s	(R<(RRt__doc__RR)R-R3R5R;tunittesttskipIftsystplatformt
skipUnlessR&R>RARG(((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyR2s
							
'
turlretrieveNetworkTestscBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s+Tests urllib.urlretrieve using the network.cGsttj|�S(N(RRturlretrieve(RR((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyRO�scCsy|jtj�\}}|jtjj|�d�t|�}z|j|j�d�Wd|j	�tj
|�XdS(Ns9file location returned by urlretrieve is not a valid paths=reading from the file location returned by urlretrieve failed(RORRR%R>tpathtexiststfileRR"tunlink(Rt
file_locationR#R@((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyR)�s
cCs�|jtjtj�\}}|j|tj�|jtjj|��t	|�}z|j|j
�d�Wd|j�tj|�XdS(Ns"reading from temporary file failed(
RORRtTESTFNR0R%R>RPRQRRRR"RS(RRTR#R@((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_specified_path�s
cCs?|jtj�\}}tj|�|j|tjd�dS(Ns.header is not an instance of mimetools.Message(RORRR>RSR*RR/(RRTtheader((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_header�s
cCs|tj}|j|�\}}tj|�|jd�}d}ytj||�Wn!tk
rw|j	d|�nXdS(NtDates%a, %d %b %Y %H:%M:%S GMTsDate value not in %r format(
RRROR>RSt	getheaderttimetstrptimet
ValueErrortfail(RtlogoRTtfileheaderst	datevaluet
dateformat((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_data_header�s	

(RRRHROR)RVRXRc(((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyRN�s		
	
	srequires sslturlopen_HttpsTestscBseZd�ZRS(cCsAtjdt�}tjdd|�}|jd|j��dS(Ntcafiles"https://self-signed.pythontest.nettcontexttPython(tssltcreate_default_contextt CERT_selfsigned_pythontestdotnetRRtassertInR(RRftresponse((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_context_argument�s(RRRm(((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyRd�sturlopen_FTPTestcBs2eZdZdZed��Zed��ZRS(sftp://www.pythontest.net/READMEicCs�tj|j���yaxZt|j�D]I}tj��5}tj�j|jt	j
j|t|���WdQXq&WWn$t
k
r�}|jd|�nXWdQXdS(NsSFailed FTP retrieve while accessing ftp url multiple times.
 Error message was : %s(Rttransient_internett
FTP_TEST_FILERtNUM_FTP_RETRIEVESttemp_dirRR6tretrieveR>RPtjointstrRR^(Rtfile_numttdte((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyttest_multiple_ftp_retrieves�s*	c	Cs�tj|j���g}zhy=x6t|j�D]%}tj|j�}|j|�q/WWn$tk
r}|j	d|�nXWdx|D]}|j
�q�WXWdQXdS(Ns2Failed FTP binary file open. Error message was: %s(RRoRpRRqRRtappendRR^R"(Rtftp_fds_to_closet_R?Rx((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyt#test_multiple_ftp_urlopen_same_host�s	
(RRRpRqRRyR}(((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyRn�s
c
CsFtjd�tjdtf��tjttttt	�WdQXdS(Ntnetworks!urllib.urlopen.. has been removed(
Rtrequirestcheck_py3k_warningstDeprecationWarningtrun_unittestR
RRNRdRn(((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyt	test_main�s
	t__main__( RIttestRttest.test_urllib2netRRRRKR>R[RhtImportErrorRRPtdirnamet__file__thereRtRjt
import_moduletTrueRRtTestCaseR
RRNRJRdRnR�R(((s:/usr/local/python-2.7/lib/python2.7/test/test_urllibnet.pyt<module>s0

	
k3#	

© 2025 GrazzMean