Current File : //opt/imh-python/lib/python2.7/test/test_urllibnet.pyc
�
��Wc@sfddlZddlmZddlZddlZddlZddlZddlZyddlZWne	k
r�dZnXejje
�Zejjed�Zejdde�Zd�Zdejfd��YZd	ejfd
��YZdejfd��YZejedkd
�dejfd��Y�Zd�Zedkrbe�ndS(i����N(ttest_supportsselfsigned_pythontestdotnet.pemt	mimetoolst
deprecatedcOsWxJtd�D]<}y||||�SWq
tk
r?}q
q
�q
Xq
W|�dS(Ni(trangetIOError(tfuncthosttargstkwargstitlast_exc((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyt_open_with_retrystURLTimeoutTestcBs)eZdZd�Zd�Zd�ZRS(g$@cCstj|j�dS(N(tsockettsetdefaulttimeouttTIMEOUT(tself((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pytsetUp'scCstjd�dS(N(R
RtNone(R((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttearDown*scCs"ttjd�}|j�}dS(Nshttp://www.example.com/(Rturllibturlopentread(Rtftx((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttestURLread-s(t__name__t
__module__RRRR(((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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(RRR(RR((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyR@scCsi|jd�}x+dD]#}|jt||�d	|�qWz|j|j�d
�Wd|j�XdS(Nshttp://www.example.com/Rtreadlinet	readlinestfilenotclosetinfotgeturls3object returned from urlopen lacks the %s attributescalling 'read' failed(sreadsreadlines	readlinessfilenosclosesinfosgeturl(Rt
assertTruethasattrRR (Rtopen_urltattr((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyt
test_basicCs
cCsW|jd�}z6|j|j�td�|j|j�td�Wd|j�XdS(Nshttp://www.example.com/s readline did not return a stringsreadlines did not return a list(RtassertIsInstanceRt
basestringRtlistR (RR%((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_readlinesOscCs]|jd�}z|j�}Wd|j�|j|tjd�|j|j�d�XdS(Nshttp://www.example.com/sAobject returned by 'info' is not an instance of mimetools.Messagethtml(RR!R R(RtMessagetassertEqualt
getsubtype(RR%tinfo_obj((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyt	test_infoZs
cCsGd}|j|�}z|j�}Wd|j�X|j||�dS(Nshttp://www.example.com/(RR"R R.(RtURLR%t
gotten_url((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_geturlfscCsMd}tj�j|�}z|j�}Wd|j�X|j|d�dS(Ns'http://www.pythontest.net/XXXinvalidXXXi�(RtFancyURLopenertopentgetcodeR R.(RR2R%tcode((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_getcodepstwin32snot appropriate for Windowstfdopensos.fdopen not availablecCsV|jd�}|j�}tj|�}z|j|j�d�Wd|j�XdS(Nshttp://www.example.com/s<reading from file created using fd returned by fileno failed(RRtosR;R#RR (RR%tfdtFILE((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/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/(R
t
gethostbynametgaierrortskipTesttassertRaisesRRR(Rtbogus_domain((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_bad_address�s	(swin32(RRt__doc__RR'R+R1R4R9tunittesttskipIftsystplatformt
skipUnlessR$R<R?RE(((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyR1s
					
	
'turlretrieveNetworkTestscBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s+Tests urllib.urlretrieve using the network.cGsttj|�S(N(RRturlretrieve(RR((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyRM�scCsv|jd�\}}|jtjj|�d�t|�}z|j|j�d�Wd|j�tj|�XdS(Nshttp://www.example.com/s9file location returned by urlretrieve is not a valid paths=reading from the file location returned by urlretrieve failed(	RMR#R<tpathtexiststfileRR tunlink(Rt
file_locationR!R>((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyR'�s
cCs�|jdtj�\}}|j|tj�|jtjj|��t|�}z|j|j	�d�Wd|j
�tj|�XdS(Nshttp://www.example.com/s"reading from temporary file failed(RMRtTESTFNR.R#R<RNRORPRR RQ(RRRR!R>((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_specified_path�s	
cCs<|jd�\}}tj|�|j|tjd�dS(Nshttp://www.example.com/s.header is not an instance of mimetools.Message(RMR<RQR(RR-(RRRtheader((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_header�s
cCsyd}|j|�\}}tj|�|jd�}d}ytj||�Wn!tk
rt|jd|�nXdS(Nshttp://www.example.com/tDates%a, %d %b %Y %H:%M:%S GMTsDate value not in %r format(RMR<RQt	getheaderttimetstrptimet
ValueErrortfail(RtlogoRRtfileheaderst	datevaluet
dateformat((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_data_header�s

(RRRFRMR'RTRVRa(((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyRL�s		
	
	srequires sslturlopen_HttpsTestscBseZd�ZRS(cCsAtjdt�}tjdd|�}|jd|j��dS(Ntcafiles"https://self-signed.pythontest.nettcontexttPython(tssltcreate_default_contextt CERT_selfsigned_pythontestdotnetRRtassertInR(RRdtresponse((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyttest_context_argument�s(RRRk(((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyRb�sc	CsCtjd�tjdtf��tjtttt�WdQXdS(Ntnetworks!urllib.urlopen.. has been removed(	Rtrequirestcheck_py3k_warningstDeprecationWarningtrun_unittestRRRLRb(((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyt	test_main�s
	t__main__(RGttestRR
RRIR<RYRftImportErrorRRNtdirnamet__file__theretjoinRht
import_moduletTrueRRtTestCaseRRRLRHRbRqR(((sl/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_urllibnet.pyt<module>s,

	
k3