%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_cfgparser.pyc


Nac@spddlZddlZddlZddlZddlZddlmZdejfdYZdejfdYZ	de	fdYZ
d	e	fd
YZde	fdYZd
e
fdYZ
de
fdYZdejfdYZdejfdYZdefdYZdejfdYZdZedkrlendS(iN(ttest_supportt
SortedDictcBsDeZdZdZdZdZdZeZdZRS(cCs|jj}|j|S(N(tdatatitemstsort(tselftresult((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs
cCs|jj}|j|S(N(RtkeysR(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs
cCs'|j}g|D]}|d^qS(Ni(R(RRti((s//usr/local/lib/python2.7/test/test_cfgparser.pytvaluesscCst|jS(N(titerR(R((s//usr/local/lib/python2.7/test/test_cfgparser.pyt	iteritemstcCst|jS(N(R
R(R((s//usr/local/lib/python2.7/test/test_cfgparser.pytiterkeysRcCst|jS(N(R
R	(R((s//usr/local/lib/python2.7/test/test_cfgparser.pyt
itervaluesR(	t__name__t
__module__RRR	RR
t__iter__R(((s//usr/local/lib/python2.7/test/test_cfgparser.pyR
s					tTestCaseBasecBseZeZddZddZdZdZdZ	dZ
dZdZdZ
d	Zd
ZdZdZd
ZdZdZdZRS(cCsI|dkr'|jd|j|_n|j|d|j|_|jS(Ntallow_no_value(tNonetconfig_classRtcf(Rtdefaults((s//usr/local/lib/python2.7/test/test_cfgparser.pyt	newconfig#s
cCs/|j|}tj|}|j||S(N(RtStringIOtreadfp(RtstringRRtsio((s//usr/local/lib/python2.7/test/test_cfgparser.pyt
fromstring+s
cCsd}|jr|d7}n|j|}|j}|jddddddd	g}|jru|jd
n|j|j}|||||jddd||jd	dd||jddd||jdd
d||jddd|jr7||jd
ddn|jd|j	dd|j
|jddd|j|j
ddd|j|jddd|jtj|jdd||jddddS(NsQ[Foo Bar]
foo=bar
[Spacey Bar]
foo = bar
[Commented Bar]
foo: bar ; comment
[Long Line]
foo: this line is much, much longer than my editor
   likes it.
[Section\with$weird%characters[	]
[Internationalized Stuff]
foo[bg]: Bulgarian
foo=Default
foo[en]=English
foo[de]=Deutsch
[Spaces]
key with spaces : value
another with spaces = splat!
s[NoValue]
option-without-value
s
Commented BarsFoo BarsInternationalized Stuffs	Long LinesSection\with$weird%characters[	tSpacess
Spacey BartNoValuetfootbarskey with spacestvaluesanother with spacesssplat!soption-without-valueRs3__name__ "option" should not be exposed by the API!s4remove_option() failed to report existence of options'remove_option() failed to remove optionsIremove_option() failed to report non-existence of option that was removedsNo Such Sections7this line is much, much longer than my editor
likes it.(RRtsectionsRtappendtassertEqualtgetRtassertNotIntoptionst
assertTruet
remove_optiontassertFalset
has_optiontassertRaisestConfigParsertNoSectionError(Rt
config_stringRtLtEteq((s//usr/local/lib/python2.7/test/test_cfgparser.pyt
test_basic1sL	

		
	
	cCs|j}|jd|jd|j}|j|j}||ddg|jddd||jddg||jdddd|j|j	dd|jdddx*dD]"}|j|j	d|dqW||jdd	g||jddg|j
dd||jdg|jd
}||jddg||jddd|jddidd6}|j|j	dddS(NtAtatBR"tbs@could not locate option, expecting case-insensitive option namessA-Bs	A-B valuesa-bsA-bsa-Bs9has_option() returned false for option which should exists,[MySection]
Option: first line
	second line
t	MySectiontoptiontOptionsfirst line
second lines[section]
nekey=nevalue
RtkeytsectiontKey(sa-bsA-bsa-BsA-B(Rtadd_sectionR#RR%tsetR(R&R)R,R*R(RRR1R3topt((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_case_sensitivity{s8


	
	cCsn|jidd6}|j|jdddd|jidd6}|j|jdddddS(NtBarR tDEFAULTtFoos@could not locate option, expecting case-insensitive option namess<could not locate option, expecting case-insensitive defaults(RR%R&(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_default_case_sensitivityscCsm|j|jtjd|jtjd|jtjd|jtjd|jtjddS(Ns[Foo]
  extra-spaces: splat
s[Foo]
  extra-spaces= splat
s![Foo]
:value-without-option-name
s![Foo]
=value-without-option-name
sNo Section!
(Rtparse_errorR.tParsingErrortMissingSectionHeaderError(R((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_parse_errorss
cCs,tj|}|j||jj|dS(N(RR-RR(RtexctsrcR((s//usr/local/lib/python2.7/test/test_cfgparser.pyRGscCs|j}|j|jgd|j|jdd|jtj|jd|jtj|j	ddd|j
tjdd|jd|j
tjdddS(Ns0new ConfigParser should have no defined sectionsREs5new ConfigParser should have no acknowledged sectionsR R!R"(
RR%R#R+thas_sectionR-R.R/R(R@t	get_errorR?t
NoOptionError(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_query_errorss

cCsOy|jj||Wn|k
r-}|SX|jd|j|jfdS(Nsexpected exception type %s.%s(RR&tfailRR(RRKR=R:te((s//usr/local/lib/python2.7/test/test_cfgparser.pyRNs	cCs|jd}xntddD]]}|j|jdd||j|jdd||jt|jdd|qWdS(Ns{[BOOLTEST]
T1=1
T2=TRUE
T3=True
T4=oN
T5=yes
F1=0
F2=FALSE
F3=False
F4=oFF
F5=nO
E1=2
E2=foo
E3=-1
E4=0.1
E5=FALSE AND MOREiitBOOLTESTst%dsf%dse%d(RtrangeR)t
getbooleanR+R-t
ValueError(RRtx((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_booleans		cCs6|j}|jd|jtj|jddS(NRE(RR?R-R.tDuplicateSectionError(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_weird_errorss
cCszd}|jr|d7}n|j|}tj}|j|d}|jr`|d7}n|j|j|dS(Nss[Long Line]
foo: this line is much, much longer than my editor
   likes it.
[DEFAULT]
foo: another very
 long line
s![Valueless]
option-without-value
su[DEFAULT]
foo = another very
	long line

[Long Line]
foo = this line is much, much longer than my editor
	likes it.

s"[Valueless]
option-without-value

(RRRtwriteR%tgetvalue(RR0Rtoutputt
expect_string((s//usr/local/lib/python2.7/test/test_cfgparser.pyt
test_writes	

		
cCs|jd}dtfdY}|jddd|jdd|d|jddd|jdd|ddS(Ns[sect]
option1=foo
tmystrcBseZRS((RR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyR`stsecttoption1tsplattoption2(RtstrR@(RRR`((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_set_string_typesscCsnytWntk
r(|jdnX|jd}|jddtd|jddtddS(Nsno unicode supports[sect]
option1=foo
RaRbRcRd(tunicodet	NameErrortskipTestRR@(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_set_unicode s
cCstjd}|j}|j|dg}|j||g|j|jddd|j}|j|}|j||g|j|jddd|j}|jdg}|j|g|j}|jg}|j|gdS(Nscfgparser.1snonexistent-filesFoo BarR tnewbar(RtfindfileRtreadR%R&(Rtfile1Rtparsed_files((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_read_returns_file_list+scCs|jddidd6S(Ns[Foo]
bar=something %(with1)s interpolation (1 step)
bar9=something %(with9)s lots of interpolation (9 steps)
bar10=something %(with10)s lots of interpolation (10 steps)
bar11=something %(with11)s lots of interpolation (11 steps)
with11=%(with10)s
with10=%(with9)s
with9=%(with8)s
with8=%(With7)s
with7=%(WITH6)s
with6=%(with5)s
With5=%(with4)s
WITH4=%(with3)s
with3=%(with2)s
with2=%(with1)s
with1=with

[Mutual Recursion]
foo=%(bar)s
bar=%(foo)s

[Interpolation Error]
name=%(reference)s
Rs%(__name__)stgetname(R(R((s//usr/local/lib/python2.7/test/test_cfgparser.pytget_interpolation_configAscCsO|jddidd6}t|jd}|j|j||dS(NsY[section]
name = value
key: |%(name)s| 
getdefault: |%(default)s|
getname: |%(__name__)s|Rs	<default>tdefaultR=(RtlistRRR%(RtexpectedRR1((s//usr/local/lib/python2.7/test/test_cfgparser.pytcheck_items_config]s
N(RRtFalseRRRRR4RBRFRJRGRPRNRXRZR_RfRjRpRrRv(((s//usr/local/lib/python2.7/test/test_cfgparser.pyR s$	J	#	
	
							$				tConfigParserTestCasecBs;eZejZeZdZdZdZdZ	RS(cCsidtj6dtj6}|j}|j}||jddd||jddd||jddd||jdd	d
|jtjdddS(Ns5something %(with11)s lots of interpolation (11 steps)s	%(with1)sRERqR!s%something with interpolation (1 step)tbar9s.something with lots of interpolation (9 steps)tbar10s/something with lots of interpolation (10 steps)tbar11(R.tSafeConfigParserRrR%R&RNtInterpolationDepthError(RtrawvalRR3((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_interpolationns

	cCs_|j|jtjdd}|j|jd|j|jd|j|jddS(NsInterpolation Errortnamet	reference(RrRNR.tInterpolationErrorR%RR=R:(RRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyt test_interpolation_missing_value~s
cCs |jddd
ddgdS(NRss	<default>t
getdefaults|<default>|Rqs	|section|R<s|value|RR"(Rss	<default>(Rs|<default>|(Rqs	|section|(R<s|value|(RR"(Rv(R((s//usr/local/lib/python2.7/test/test_cfgparser.pyt
test_itemss
	cCs|j}|jd|jddd|jddddddddd	d
dg	|jddid
d6dd6dd6|jddd|jdd|j|jdddtd|jt|jdd|j|jdddtddddddd	d
dg	|jt|jdd|j|jdddtid
d6dd6dd6|jt|jdd|j|jdddtd|jt|jdddt	|j|jddddS(Ns
non-stringtintiRtiiiiii
s%(tdictgn!	@tpis%(list)tstring_with_interpolations%(list)ssno-valuetraw(RR?R@R%R&tTrueR-t	TypeErrorRVRwR(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_set_nonstring_typess*
.""

(
RRR.RRRRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRxjs				tMultilineValuesTestCasecBs>eZejZdjddZdZdZdZRS(sSI'm having spam spam spam spam spam spam spam beaked beans spam spam spam and spam!t s	
cCs|j}xftdD]X}dj|}|j|x3tdD]%}|j|dj||jqHWqWttjd}|j	|WdQXdS(Nids	section{}i
s
lovely_spam{}tw(
RRTtformatR?R@twonderful_spamtopenRtTESTFNR[(RRRtstjtf((s//usr/local/lib/python2.7/test/test_cfgparser.pytsetUps
'cCstjtjdS(N(tostunlinkRR(R((s//usr/local/lib/python2.7/test/test_cfgparser.pyttearDownscCs`|j}ttj}|j|WdQX|j|jdd|jjdddS(Ntsection8tlovely_spam4s	
s
(	RRRRRR%R&Rtreplace(Rtcf_from_fileR((s//usr/local/lib/python2.7/test/test_cfgparser.pyt test_dominating_multiline_valuess
(	RRR.RRRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs		
	tRawConfigParserTestCasecBs,eZejZdZdZdZRS(cCs|j}|j}||jddd||jddd||jddd||jddd	||jdd
ddS(NRERqs%(__name__)sR!s*something %(with1)s interpolation (1 step)Rys3something %(with9)s lots of interpolation (9 steps)Rzs5something %(with10)s lots of interpolation (10 steps)R{s5something %(with11)s lots of interpolation (11 steps)(RrR%R&(RRR3((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs	cCs |jddd
ddgdS(NRss	<default>Rs
|%(default)s|Rqs|%(__name__)s|R<s
|%(name)s|RR"(Rss	<default>(Rs
|%(default)s|(Rqs|%(__name__)s|(R<s
|%(name)s|(RR"(Rv(R((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs
	cCs|j}|jd|jddd|jddddddddd	d
g|jddidd
6|j|jddd|j|jddddddddd	d
g|j|jddidd
6dS(Ns
non-stringRiRtiiiiii
Rgn!	@R(RR?R@R%R&(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs
+(RRR.tRawConfigParserRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs		
	tSafeConfigParserTestCasecBs>eZejZdZdZdZdZdZ	RS(cCsK|jd}|j|jddd|j|jddddS(NsW[section]
option1=xxx
option2=%(option1)s/xxx
ok=%(option1)s/%%s
not_ok=%(option2)s/%%sR=toksxxx/%stnot_oks
xxx/xxx/%s(RR%R&(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_safe_interpolationscCs|jd}|j|jddd|jt|jddd|jt|jddd|jt|jddd|j|jddd|jddd	|j|jddd
dS(Ns[sect]
option1=foo
RaRbR s%foosfoo%sf%ooRdsfoo%%barsfoo%bar(RR%R&R-RVR@(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyt#test_set_malformatted_interpolationscCs|jd}|jt|jddd|jt|jddd|jt|jddt|jt|jddd|jt|jddd|jt|jddtdS(Ns[sect]
option1=foo
RaRbig?Rd(RR-RR@tobject(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyRscCs&|j}|jt|jddS(NRs(RR-RVR?(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_add_section_default_1scCs&|j}|jt|jddS(NRD(RR-RVR?(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_add_section_default_2s(
RRR.R|RRRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRs		
			tSafeConfigParserTestCaseNoValuecBseZeZRS((RRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRstTestChainMapcBseZdZRS(c
Cs7tdddd}tdddd}|j}|j|tj||}|j|jt|jt	|jt	|j|jt	|j
t	|j
|jt	|jt	|j|jt	|t	||j|||jg|D]}||^q|j
dj}|jg|D]}|j
|d	^qUg|D]}|j
|d	^qw|jg|D]}||k^qg|D]}||k^qtjM|jg|D]}|j|^qg|D]}|j|^qWdQXdS(
Ntreditgreeniitblueisred green blue black browni
(RtcopytupdateR.t	_ChainmaptassertIsInstanceRRtR%R@R	RtsplitR&Rtcheck_py3k_warningsthas_key(Rtd1td2tdcombtcmtktklist((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_issue_12717s(
(((-(&" 
%(RRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRstIssue7005TestCasecBs/eZdZdZdZdZdZRS(srTest output when None is set() as a value and allow_no_value == False.

    http://bugs.python.org/issue7005

    s[section]
option = None

cCsR|dt}|jd|jdddtj}|j||jS(NRR=R:(RwR?R@RRR[R\(RRtcpR((s//usr/local/lib/python2.7/test/test_cfgparser.pytprepare8s

cCs)|jtj}|j||jdS(N(RR.R%texpected_output(RR]((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_none_as_value_stringifiedAscCs)|jtj}|j||jdS(N(RR.RR%R(RR]((s//usr/local/lib/python2.7/test/test_cfgparser.pyt"test_none_as_value_stringified_rawEs(RRt__doc__RRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyR/s
			tSortedTestCasecBseZddZdZRS(cCs"|jd|dt|_|jS(NRt	dict_type(RRR(RR((s//usr/local/lib/python2.7/test/test_cfgparser.pyRKscCsC|jdtj}|jj||j|jddS(Ns [b]
o4=1
o3=2
o2=3
o1=4
[a]
k=v
s,[a]
k = v

[b]
o1 = 4
o2 = 3
o3 = 2
o4 = 1

(RRRR[R%R\(RR]((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_sortedOs

N(RRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRJstExceptionPicklingTestCasecBsheZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZRS(sBTests for issue #13760: ConfigParser exceptions are not picklable.cCsddl}tjd}xnt|jdD]Y}|j||}|j|}|j|j|j|jt	|t	|q/WdS(NiR"i(
tpickleR.tErrorRTtHIGHEST_PROTOCOLtdumpstloadsR%tmessagetrepr(RRte1tprototpickledte2((s//usr/local/lib/python2.7/test/test_cfgparser.pyt
test_errorfscCsddl}tjd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|jt|t|q/WdS(NiR=i(RR.R/RTRRRR%RtargsR=R(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_nosectionerroroscCsddl}tjdd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|j|j|j|jt|t|q2WdS(NiR:R=i(
RR.RORTRRRR%RRR=R:R(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_nooptionerrorzscCsddl}tjd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|jt|t|q/WdS(NiR=i(RR.RYRTRRRR%RRR=R(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_duplicatesectionerrorscCsddl}tjddd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|j|j|j|jt|t|q5WdS(NiR:R=tmsgi(
RR.RRTRRRR%RRR=R:R(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_interpolationerrorscCsddl}tjdddd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|j|j|j|j|j|j|jt
|t
|q8WdS(NiR:R=R~Ri(RR.tInterpolationMissingOptionErrorRTRRRR%RRR=R:RR(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyt$test_interpolationmissingoptionerrorscCsddl}tjddd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|j|j|j|jt|t|q5WdS(NiR:R=Ri(
RR.tInterpolationSyntaxErrorRTRRRR%RRR=R:R(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_interpolationsyntaxerrorscCsddl}tjddd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|j|j|j|jt|t|q5WdS(NiR:R=R~i(
RR.R}RTRRRR%RRR=R:R(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_interpolationdeptherrors	cCsddl}tjd}|jdd|jdd|jddxt|jdD]}|j||}|j|}|j|j	|j	|j|j
|j
|j|j|j|j|j|j|jt
|t
|q_WdS(	Nitsourceitline1itline2itline3(RR.RHR$RTRRRR%RRtfilenameterrorsR(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_parsingerrorscCsddl}tjddd}xt|jdD]}|j||}|j|}|j|j|j|j|j	|j	|j|j
|j
|j|j|j|j|j|j|jt
|t
|q5WdS(NiRi{tlinei(RR.RIRTRRRR%RRRRtlinenoR(RRRRRR((s//usr/local/lib/python2.7/test/test_cfgparser.pyttest_missingsectionheadererrors(
RRRRRRRRRRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyRcs									
	c
Cs)tjtttttttt	t
	dS(N(Rtrun_unittestRxRRRRRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyt	test_mainst__main__(R.RRtunittesttUserDictttestRRtTestCaseRRxRRRRRRRRRR(((s//usr/local/lib/python2.7/test/test_cfgparser.pyt<module>s(K:#2~	

Zerion Mini Shell 1.0