mς %U²Ic@szdkZdklZdfd„ƒYZdfd„ƒYZdeifd„ƒYZd„Zed jo eƒndS( N(sTemplatetBagcBstZRS(N(t__name__t __module__(((t-/data/zmath/lib/python2.4/test/test_pep292.pyR stMappingcBstZd„ZRS(NcCsY|}xL|idƒD];}yt||ƒ}Wqtj ot|ƒ‚qXqW|S(Nt.(tselftobjtnametsplittparttgetattrtAttributeErrortKeyError(RRRR ((Rt __getitem__ s(RRR(((RR st TestTemplatecBs†tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „Zd„Z RS(NcCsWtdƒ}|i|itddddƒƒdƒ|it|itddƒƒdS(Ns,$who likes to eat a bag of $what worth $$100twhottimtwhatthams(tim likes to eat a bag of ham worth $100(tTemplatetsRt assertEqualt substitutetdictt assertRaisesR (RR((Rttest_regular_templatess !cCsitdƒ}tddddddƒ}|i|i|ƒdƒ|it|itddddƒƒdS( Ns$who likes ${what} for ${meal}RRRRtmealtdinnerstim likes ham for dinner( RRRtdRRRRR (RRR((Rt"test_regular_templates_with_bracess  cCso|i}tdƒ}||itddddƒƒdƒtdƒ}||itddddƒƒdƒdS( Ns-$who likes to eat a bag of $$what worth $$100RRRRs*tim likes to eat a bag of $what worth $100s $who likes $$s tim likes $(RRteqRRRR(RRR((Rt test_escapes%s    cCsT|i}tdƒ}tddƒ}||i|ƒdƒ||i|ƒdƒdS(Ns%(foo)s $foo ${foo}tfootbazs%(foo)s baz baz( RRRRRRRRtsafe_substitute(RRRR((Rt test_percents-s   cCsv|i}tdƒ}tddƒ}||i|ƒdƒ||i|ƒdƒtdƒ}||i|ƒdƒdS(Ns&tim has eaten $count bags of ham todaytcountis!tim has eaten 7 bags of ham todays(tim has eaten ${count} bags of ham today( RRRRRRRRR#(RRRR((Rttest_stringification4s   c CsΜ|i}tdƒ}||itddƒƒdƒ||itddƒƒdƒ||itdddd ƒƒd ƒ||itddddƒƒd ƒ||itdddddd ƒƒd ƒdS( Ns$who likes ${what} for ${meal}RRstim likes ${what} for ${meal}RRs$who likes ham for ${meal}RRs$who likes ham for dinnerstim likes ham for ${meal}stim likes ham for dinner(RRRRRR#R(RRR((Rttest_SafeTemplate=s  $cCs…|i}tdƒ}|t|itddƒƒtdƒ}|t|itddƒƒtdƒ}|t|itddƒƒdS(Ns $who likes $RRs$who likes ${what)s$who likes $100(RRtraisesRRt ValueErrorRR(RRR(((Rttest_invalid_placeholdersIs    cCsNdtfd„ƒY}|dƒ}|i|itddddƒƒdƒdS( Nt PieDelimscBstZdZRS(Nt@(RRt delimiter(((RR+Sss-@who likes to eat a bag of @{what} worth $100RRRRs(tim likes to eat a bag of ham worth $100(RR+RRRRR(RR+R((Rttest_delimiter_overrideRs !cCs~dtfd„ƒY}tƒ}tƒ|_tƒ|i_d|ii_d|i_|dƒ}|i |i |ƒdƒdS(Nt PathPatterncBstZdZRS(Ns[_a-z][._a-z0-9]*(RRt idpattern(((RR/ZsRRs,$bag.foo.who likes to eat a bag of $bag.whatstim likes to eat a bag of ham( RR/RtmRtbagR!RRRRRR(RR/R1R((Rttest_idpattern_overrideYs    cCsΜdtfd„ƒY}tƒ}tƒ|_tƒ|i_d|ii_d|i_|dƒ}|i |i |ƒdƒdtfd„ƒY}|dƒ}|it|i hƒ|it|ihƒdS( Nt MyPatterncBstZdZRS(NsΎ (?P@{2}) | @(?P[_a-z][._a-z0-9]*) | @{(?P[_a-z][._a-z0-9]*)} | (?P@) (RRtpattern(((RR4esRRs,@bag.foo.who likes to eat a bag of @bag.whatstim likes to eat a bag of hamt BadPatterncBstZdZRS(Ns (?P.*) | (?P@{2}) | @(?P[_a-z][._a-z0-9]*) | @{(?P[_a-z][._a-z0-9]*)} | (?P@) | (RRR5(((RR6ts(RR4RR1RR2R!RRRRRRR6RR)R#(RR6R1RR4((Rttest_pattern_overrideds     cCs>tdƒ}tddddƒ}|i|i|ƒdƒdS(Ns$who likes $whatRutΓΏmRufΓΎ edutΓΏm likes fΓΎ ed(RRRRRRR(RRR((Rttest_unicode_values€s cCsδ|i}tdƒ}||iddddƒdƒ||itddƒddƒdƒ||itddddƒddddƒdƒtd ƒ}||itd d ƒd d ƒdƒ||itd dƒd dƒdƒdS(Ns$who likes $whatRRRRs tim likes hamtfredskung paosthe mapping is $mappingR!tnonetmappingtbozosthe mapping is bozotonettwosthe mapping is two(RRRRRRR(RRR((Rttest_keyword_arguments…s  % cCs(|i}|i}tdƒ}||iddddƒdƒ||itddƒddƒdƒ||itddddƒddddƒdƒtd ƒ}||itd d ƒd d ƒdƒ||itd dƒd dƒdƒtd dƒ}|t |i |hƒ|t |i|hƒdS(Ns$who likes $whatRRRRs tim likes hamR9skung paosthe mapping is $mappingR!R:R;R<sthe mapping is bozoR=R>sthe mapping is two( RRRRR(RRR#RRt TypeErrorR(RRRR(R((Rttest_keyword_arguments_safe“s    % cCsΪ|i}|i}dtfd„ƒY}|dƒ}||iddddƒdƒ|t |iƒ||i ddddƒdƒ||i ƒd ƒ|d ƒ}|t |it ddddƒƒ||i ƒd ƒdS( NtAmpersandTemplatecBstZdZRS(Nt&(RRR-(((RRB¨ssthis &gift is for &{who} &&tgifttbudRtyousthis bud is for you &sthis &gift is for &{who} &( RRRRR(RRBRRR R#R)R(RRBRR(R((RR.₯s    "(RRRRR R$R&R'R*R.R3R7R8R?RA(((RRs         cCs'dkl}tg}|i|ŒdS(N(s test_support(ttestt test_supportRt test_classest run_unittest(RHRI((Rt test_main΄s  t__main__( tunittesttstringRRRtTestCaseRRKR(RRMRRRKR((Rt?s   