config root man

Current Path : /compat/linux/proc/self/root/usr/local/lib/python2.5/test/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //compat/linux/proc/self/root/usr/local/lib/python2.5/test/test_urllib.pyo

³ò
h”Rc@sGdZddkZddkZddkZddklZddkZddkZddkZddk	Z	d„Z
deifd„ƒYZdeifd„ƒYZ
d	eifd
„ƒYZdeifd„ƒYZd
eifd„ƒYZdeifd„ƒYZdeifd„ƒYZd„ZedjoeƒndS(sRegresssion tests for urllibiÿÿÿÿN(ttest_supportcCsEtt|ƒƒdiƒ}t|ƒdjod|}nd|S(s!Escape char as RFC 2396 specifiesiis0%st%(thextordtuppertlen(tcharthex_repr((s,/usr/local/lib/python2.5/test/test_urllib.pyt	hexescapesturlopen_FileTestscBsqeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
RS(s©Test urlopen() opening a temporary file.

    Try to test as much functionality as possible so as to cut down on reliance
    on connecting to the Net for testing.

    cCspd|ii|_ttidƒ}z|i|iƒWd|iƒXti|_t	i
d|iƒ|_dS(s'Setup of a temp file to use for testingstest_urllib: %s
twbNsfile:%s(t	__class__t__name__ttexttfileRtTESTFNtwritetclosetpathnameturllibturlopentreturned_obj(tselftFILE((s,/usr/local/lib/python2.5/test/test_urllib.pytsetUpscCs!|iiƒtitiƒdS(sShut down the open objectN(RRtostremoveRR(R((s,/usr/local/lib/python2.5/test/test_urllib.pyttearDown&s
cCs5x.d
D]&}|it|i|ƒd	|ƒqWdS(Ntreadtreadlinet	readlinestfilenoRtinfotgeturlt__iter__s/object returned by urlopen() lacks %s attribute(sreadsreadlines	readlinessfilenosclosesinfosgeturls__iter__(tassert_thasattrR(Rtattr((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_interface+scCs |i|i|iiƒƒdS(N(tassertEqualR
RR(R((s,/usr/local/lib/python2.5/test/test_urllib.pyt	test_read3scCs<|i|i|iiƒƒ|id|iiƒdƒdS(NtsKcalling readline() after exhausting the file did not return an empty string(R'R
RR(R((s,/usr/local/lib/python2.5/test/test_urllib.pyt
test_readline6scCsF|iiƒ}|it|ƒddƒ|i|d|idƒdS(Nis.readlines() returned the wrong number of linesis"readlines() returned improper text(RRR'RR
(Rt
lines_list((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_readlines<s
cCsW|iiƒ}|it|tƒdƒ|iti|t|i	ƒƒ|i	dƒdS(Nsfileno() did not return an intsTReading on the file descriptor returned by fileno() did not return the expected text(
RRR#t
isinstancetintR'RRRR
(Rtfile_num((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_filenoCs
$cCs|iiƒdS(N(RR(R((s,/usr/local/lib/python2.5/test/test_urllib.pyt
test_closeKscCs&|it|iiƒtiƒƒdS(N(R#R-RR t	mimetoolstMessage(R((s,/usr/local/lib/python2.5/test/test_urllib.pyt	test_infoPscCs |i|iiƒ|iƒdS(N(R'RR!R(R((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_geturlSscCs1x*|iiƒD]}|i||iƒqWdS(N(RR"R'R
(Rtline((s,/usr/local/lib/python2.5/test/test_urllib.pyt	test_iterVs(Rt
__module__t__doc__RRR&R(R*R,R0R1R4R5R7(((s,/usr/local/lib/python2.5/test/test_urllib.pyR	s										turlopen_HttpTestscBs2eZdZd„Zd„Zd„Zd„ZRS(s.Test urlopen() opening a fake http connection.csKdtifd„ƒY‰dtif‡‡fd†ƒY}|ti_dS(Nt
FakeSocketcBs2eZd„Zd„Zdd„Zdd„ZRS(cSsdS(N((Rtstr((s,/usr/local/lib/python2.5/test/test_urllib.pytsendallcscSs|S(N((Rtmodetname((s,/usr/local/lib/python2.5/test/test_urllib.pytmakefiledscSs%|iodSntii||ƒS(NR)(tclosedtStringIOR(Rtamt((s,/usr/local/lib/python2.5/test/test_urllib.pyRes
cSs%|iodSntii||ƒS(NR)(RARBR(Rtlength((s,/usr/local/lib/python2.5/test/test_urllib.pyRhs
N(RR8R=R@tNoneRR(((s,/usr/local/lib/python2.5/test/test_urllib.pyR;bs		tFakeHTTPConnectioncseZ‡‡fd†ZRS(csˆˆƒ|_dS(N(tsock(R(tfakedataR;(s,/usr/local/lib/python2.5/test/test_urllib.pytconnectls(RR8RI((R;RH(s,/usr/local/lib/python2.5/test/test_urllib.pyRFks(RBthttplibtHTTPConnectiontHTTPt_connection_class(RRHRF((RHR;s,/usr/local/lib/python2.5/test/test_urllib.pytfakehttpas	"cCstiti_dS(N(RJRKRLRM(R((s,/usr/local/lib/python2.5/test/test_urllib.pyt
unfakehttpqscCs^|idƒz?tidƒ}|i|iƒdƒ|i|iƒdƒWd|iƒXdS(NsHello!shttp://python.org/R)(RNRRR'RRO(Rtfp((s,/usr/local/lib/python2.5/test/test_urllib.pyR(ts
cCs9|idƒz|ittidƒWd|iƒXdS(s]urlopen() raises IOError if the underlying socket does not send any
        data. (#1680230) R)shttp://somethingN(RNtassertRaisestIOErrorRRRO(R((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_empty_socket}s
(RR8R9RNROR(RS(((s,/usr/local/lib/python2.5/test/test_urllib.pyR:^s
				turlretrieve_FileTestscBsteZdZd„Zd„Zd„Zdd„Zd„Zd„Zd„Z	d	„Z
d
„Zd„Zd„Z
RS(
s(Test urllib.urlretrieve() on local filescCsrg|_|itiƒd|_z0ttidƒ}|i|iƒ|iƒWdy|iƒWnnXXdS(Nstesting urllib.urlretrieveR
(t	tempFilestregisterFileForCleanUpRRR
RRR(RR((s,/usr/local/lib/python2.5/test/test_urllib.pyR‰s		cCs3x,|iD]!}yti|ƒWq
q
Xq
WdS(N(RURR(Rteach((s,/usr/local/lib/python2.5/test/test_urllib.pyRžs
cCsdtitii|ƒƒS(Ns	file://%s(Rtpathname2urlRtpathtabspath(RtfilePath((s,/usr/local/lib/python2.5/test/test_urllib.pytconstructLocalFileUrl¤sR)cCsltiƒ\}}z:|i|ƒti|dƒ}|i|ƒ|iƒWdy|iƒWnnXX|S(s¹Creates a new temporary file containing the specified data,
        registers the file for deletion during the test fixture tear down, and
        returns the absolute path of the file.R
N(ttempfiletmkstempRVRtfdopenRR(RtdatatnewFdtnewFilePathtnewFile((s,/usr/local/lib/python2.5/test/test_urllib.pytcreateNewTempFile§s

cCs|ii|ƒdS(N(RUtappend(RtfileName((s,/usr/local/lib/python2.5/test/test_urllib.pyRV·scCsQtidtiƒ}|i|dtiƒ|it|dtiƒdƒdS(Nsfile:%siisAdid not get a mimetools.Message instance as second returned value(	RturlretrieveRRR'R#R-R2R3(Rtresult((s,/usr/local/lib/python2.5/test/test_urllib.pyt
test_basicºsc	CsÄdti}|i|ƒti|itiƒ|ƒ}|i||dƒ|iti	i
|ƒdƒt|dƒ}z|iƒ}|i
ƒWdy|i
ƒWnnXX|i|i|ƒdS(Ns%s.2iscopy of the file was not madetrb(RRRVRRgR\R'R#RRYtexistsRRRR
(Rtsecond_tempRhRR
((s,/usr/local/lib/python2.5/test/test_urllib.pyt	test_copyÃs

csRdg‡fd†}dti}ˆi|ƒtiˆitiƒ||ƒdS(Nicslˆit|tƒƒˆit|tƒƒˆit|tƒƒˆi||dƒ|dd|d<dS(Nii(R#R-R.R'(tcountt
block_sizet
total_sizetcount_holder(R(s,/usr/local/lib/python2.5/test/test_urllib.pyt
hooktester×s
s%s.2(RRRVRRgR\(RRrRl((Rs,/usr/local/lib/python2.5/test/test_urllib.pyttest_reporthookÕs


cCsog}|d„}|iƒ}ti|i|ƒti|ƒ|it|ƒdƒ|i|dddƒdS(NcSs|i|||fƒdS(N(Re(RnRoRpt_report((s,/usr/local/lib/python2.5/test/test_urllib.pyRråsiii(RdRRgR\RRR'R(RtreportRrtsrcFileName((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_reporthook_0_bytesâs
cCsŠg}|d„}|idƒ}ti|i|ƒti|ƒ|it|ƒdƒ|i|dddƒ|i|dddƒdS(	NcSs|i|||fƒdS(N(Re(RnRoRpRt((s,/usr/local/lib/python2.5/test/test_urllib.pyRróstxiiiii txxxxx(RdRRgR\RRR'R(RRuRrRv((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_reporthook_5_bytesís
cCsŽg}|d„}|iddƒ}ti|i|ƒti|ƒ|it|ƒdƒ|i|dddƒ|i|dddƒdS(	NcSs|i|||fƒdS(N(Re(RnRoRpRt((s,/usr/local/lib/python2.5/test/test_urllib.pyRrsRxi iiii i(RdRRgR\RRR'R(RRuRrRv((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_reporthook_8193_bytesüs
(RR8R9RRR\RdRVRiRmRsRwRzR{(((s,/usr/local/lib/python2.5/test/test_urllib.pyRT†s								
		tQuotingTestscBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(swTests for urllib.quote() and urllib.quote_plus()

    According to RFC 2396 ("Uniform Resource Identifiers), to escape a
    character you write it as '%' + <2 character US-ASCII hex value>.  The Python
    code of ``'%' + hex(ord(<character>))[2:]`` escapes a character properly.
    Case does not matter on the hex letters.

    The various character sets specified are:

    Reserved characters : ";/?:@&=+$,"
        Have special meaning in URIs and must be escaped if not being used for
        their special meaning
    Data characters : letters, digits, and "-_.!~*'()"
        Unreserved and do not need to be escaped; can be, though, if desired
    Control characters : 0x00 - 0x1F, 0x7F
        Have no use in URIs so must be escaped
    space : 0x20
        Must be escaped
    Delimiters : '<>#%"'
        Must be escaped
    Unwise : "{}|\^[]`"
        Must be escaped

    cCswdiddddgƒ}ti|ƒ}|i||d||fƒti|ƒ}|i||d||fƒdS(NR)tABCDEFGHIJKLMNOPQRSTUVWXYZtabcdefghijklmnopqrstuvwxyzt
0123456789s_.-susing quote(): %s != %ssusing quote_plus(): %s != %s(tjoinRtquoteR't
quote_plus(Rtdo_not_quoteRh((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_never_quote$s	cCs|itiiddƒdS(Nit/(R'RRt
func_defaults(R((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_default_safe1scCsnd}ti|d|ƒ}|i||d||fƒti|d|ƒ}|i||d||fƒdS(Ns<>tsafesusing quote(): %s != %ssusing quote_plus(): %s != %s(RRR'R‚(Rtquote_by_defaultRh((s,/usr/local/lib/python2.5/test/test_urllib.pyt	test_safe5sc
Cs?g}tdƒD]}|t|ƒq~}|idƒ|itdƒƒdi|ƒ}x„|D]|}ti|ƒ}|it|ƒ|d|t|ƒ|fƒti|ƒ}|it|ƒ|d|t|ƒ|fƒqcW~d}d}ti|ƒ}|i||d	||fƒ|i||d
||fƒdS(Ni s
<>#%"{}|\^[]`iR)s1using quote(): %s should be escaped to %s, not %ss6using quote_plus(): %s should be escapes to %s, not %ssab[]cds
ab%5B%5Dcdsusing quote(): %s != %ssusing quote_plus(): %s != %s(	trangetchrReR€RRR'RR‚(Rt_[1]tnumtshould_quoteRRht
partial_quotetexpected((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_default_quoting@s,-
cCsêtidƒ}|i|tdƒd|tdƒfƒtidƒ}|i|dd|ƒd}|idtdƒƒ}ti|ƒ}|i||d||fƒ|iddƒ}ti|ƒ}|i||d||fƒdS(Nt susing quote(): %s != %st+susing quote_plus(): %s != +s
a b cd e fsusing quote_plus(): %s != %s(RRR'RR‚treplace(RRhtgiventexpect((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_quoting_spaceZscCs9|itidƒdƒ|itiddƒdƒdS(Nsalpha+beta gammasalpha%2Bbeta+gammaR”salpha+beta+gamma(R'RR‚(R((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_quoting_plusms(	RR8R9R„R‡RŠR’R˜R™(((s,/usr/local/lib/python2.5/test/test_urllib.pyR|
s	
				tUnquotingTestscBs2eZdZd„Zd„Zd„Zd„ZRS(swTests for unquote() and unquote_plus()

    See the doc string for quoting_Tests for details on quoting and such.

    cCsg}x—tdƒD]‰}tt|ƒƒ}t|ƒ}ti|ƒ}|i||d||fƒti|ƒ}|i||d||fƒ|i|ƒqWdi|ƒ}~ti|ƒ}|i|i	dƒdd|ƒti|ƒ}|i|i	dƒdd|ƒdS(	Ni€susing unquote(): %s != %ssusing unquote_plus(): %s != %sR)Ris-using quote(): not all characters escaped; %ss/using unquote(): not all characters escaped: %s(
R‹RRŒRtunquoteR'tunquote_plusReR€Rn(Rtescape_listRŽR–R—Rht
escape_string((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_unquotingzs.
cCsrdtdƒ}d}ti|ƒ}|i||d||fƒti|ƒ}|i||d||fƒdS(Nsab%sdtctabcdsusing quote(): %s != %ssusing unquote_plus(): %s != %s(RRR›R'Rœ(RR–R—Rh((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_unquoting_parts“scCszd}|}ti|ƒ}|i||d||fƒ|iddƒ}ti|ƒ}|i||d||fƒdS(Nsare+there+spaces...susing unquote(): %s != %sR”R“susing unquote_plus(): %s != %s(RR›R'R•Rœ(RR–R—Rh((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_unquoting_plusŸscCs#tidƒ}|i|dƒdS(Nu"br%C3%BCckner_sapporo_20050930.docu brückner_sapporo_20050930.doc(RR›R'(Rtr((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_unquote_with_unicode«s(RR8R9RŸR¢R£R¥(((s,/usr/local/lib/python2.5/test/test_urllib.pyRšss
			turlencode_TestscBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(sTests for urlencode()c	
Cs	dddg}ti|ƒ}x1|D])}|i||jd|||fƒq%W|i|idƒdd||idƒfƒ|idƒ}||d}||d}|i|iƒo
|iƒd	||fƒ|it|ƒdd|t|ƒdfƒd
S(sHelper method for testing different input types.

        'given' must lead to only the pairs:
            * 1st, 1
            * 2nd, 2
            * 3rd, 3

        Test cannot assume anything about order.  Docs make no guarantee and
        have possible dictionary input.

        s1st=1s2nd=2s3rd=3stesting %s: %s not found in %st&is#testing %s: expected 2 '&'s; got %sis1testing %s: '&' not located in proper place in %siis5testing %s: unexpected number of characters: %s != %sNiiii(Rt	urlencodeR#R'RntindextisdigitR(	RR–t	test_typetexpect_somewhereRhR‘tamp_locationton_amp_leftton_amp_right((s,/usr/local/lib/python2.5/test/test_urllib.pythelp_inputtype²s&cCs/|ihdd<dd<dd<dƒdS(Nt1t1stt2t2ndt3t3rdsusing dict as input type(R°(R((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_using_mappingÒs$cCs|idd	d
gdƒdS(NR²R±R´R³R¶Rµs*using sequence of two-item tuples as input(s1stR±(s2ndR³(s3rdRµ(R°(R((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_using_sequence×scCs‚hdd<}dtdƒtdƒf}ti|ƒ}|i||ƒhdd<}d}ti|ƒ}|i||ƒdS(Nt=R§s%s=%ssA bunch of plusesskey nameskey+name=A+bunch+of+pluses(RRR¨R'(RR–R—Rh((s,/usr/local/lib/python2.5/test/test_urllib.pyttest_quotingÜscCs×hdddgd<}dtitdddgƒƒ}ti|ƒ}|i||ƒti|tƒ}x<|dD]0}d|}|i||jd||fƒqvW|i|idƒdd	|idƒƒdS(
NR±R³Rµtsequencessequence=%ss%s not found in %sR§isExpected 2 '&'s, got %s(RR‚R<R¨R'tTrueR#Rn(RR–R—Rhtvalue((s,/usr/local/lib/python2.5/test/test_urllib.pyt
test_doseqçs"
(RR8R9R°R·R¸RºR¾(((s,/usr/local/lib/python2.5/test/test_urllib.pyR¦¯s	 			tPathname_TestscBs eZdZd„Zd„ZRS(s&Test pathname2url() and url2pathname()cCs}tiiddddƒ}d}ti|ƒ}|i||d||fƒti|ƒ}|i||d||fƒdS(NtpartstoftaRYsparts/of/a/pathspathname2url() failed; %s != %ssurl2pathame() failed; %s != %s(RRYR€RRXR'turl2pathname(Rt
expected_pathtexpected_urlRh((s,/usr/local/lib/python2.5/test/test_urllib.pyRiøscCs(tiidddƒ}dtidƒ}ti|ƒ}|i||d||fƒ|}ti|ƒ}|i||d||fƒtiiddƒ}d	tidƒ}ti|ƒ}|i||d||fƒd
}tiiddƒ}ti|ƒ}|i||d||fƒdS(
Ntneedssquot=ingtheres
needs/%s/herespathname2url() failed; %s != %ssurl2pathname() failed; %s != %ss	make suretusing_quotes%s/using_quotesmake+sure/using_unquotes	make+suret
using_unquote(RRYR€RRRXR'RÃ(RR–R—Rh((s,/usr/local/lib/python2.5/test/test_urllib.pyRºs.(RR8R9RiRº(((s,/usr/local/lib/python2.5/test/test_urllib.pyR¿õs	
cCs#titttttttƒdS(N(	Rtrun_unittestR	R:RTR|RšR¦R¿(((s,/usr/local/lib/python2.5/test/test_urllib.pyt	test_main"st__main__(R9RRJtunittestttestRRR2R]RBRtTestCaseR	R:RTR|RšR¦R¿RËR(((s,/usr/local/lib/python2.5/test/test_urllib.pys<module>s&	K(„i<F-	



Man Man