Ñò 9ÝoLc @sddkZddkZddkZddkZddkZddkZddkZddkZddkl Z ei dei dZ Z e e fZ deifd„ƒYZdefd„ƒYZd efd „ƒYZd efd „ƒYZd efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZedjoeiƒndS(iÿÿÿÿN(tTemplateiit TemplateTestcBseZRS((t__name__t __module__(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRstClassMethods_compilecBs_eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( s‚I am using the same Cheetah source for each test to root out clashes caused by the compile caching in Template.compile(). cCsFtiddƒ}|dhdd6ƒ}t|ƒdjpt‚dS(Ntsources$foot namespacesiÒtfoot1234(RtcompiletstrtAssertionError(tselftklasstt((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_basicUsagescCstidddtƒ}|hdd6ƒ}t|ƒdjpt‚tiddd|ƒ}|hdd6ƒ}t|ƒdjpt‚tiddd|ƒ}|hdd6ƒ}t|ƒdjpt‚tiddddƒ}|hdd6ƒ}t|ƒdjpt‚dS( NRs$foot baseclassiÒRRs#implements dummy $bartdict(RR RR R (R R Rtklass2tklass3tklass4((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_baseclassArgsc CsÂtdjodStiƒ}zŒtii|ƒpt‚tidddt d|ƒ}t i |i }tii|i ƒpt‚tii|i ƒ|jpt‚Wdti|t ƒXdS(NiiRs$footcacheModuleFilesForTracebackstcacheDirForModuleFiles(ii(t versionTuplettempfiletmkdtemptostpathtexistsR RR tTruetsystmodulesRt__file__tdirnametshutiltrmtree(R ttmpDirR tmod((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_moduleFileCaching-s   'cCsctiddddƒ}|idjpt‚|dhdd6ƒ}t|ƒdjpt‚dS( NRs$foot classNametfoo123RiÒRR(RR RR R (R R R((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_classNameArg>scCsâtiddddƒ}tid}|idjpt‚|dhdd6ƒ}t|ƒdjpt‚tidddd d d ƒ}tid }|id jpt‚|dhdd6ƒ}t|ƒdjpt‚dS( NRs$foot moduleNametfoo99RiÒRRtfoo1R(tfoo2(RR RR RR R (R R R&R((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_moduleNameArgDs   c Cs tiddddddƒ}|idjpt‚|dhdd 6ƒ}t|ƒd jpt‚|iƒd jpt‚tiddd d ddddd tƒ}|idjpt‚|hdd 6ƒ}t|ƒd jpt‚|iƒd jpt‚dS(NRs$fooR(R)tmainMethodNamettestMethRiÒRRR+tfooXXXR(RR RR R R1R(R R R((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_mainMethodNameArgUs   c Csçtidddhdd6ƒ}|ƒ}t|ƒdjpt‚tidddddhtd6ƒ}|hdd6ƒ}t|ƒdjpt‚tidddddhtd6dd6ƒ}|ƒ}t|ƒdjpt‚dS( NRs$foot moduleGlobalsiÒRRRtTest1(RR R R R(R R RRR((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_moduleGlobalsArgls  c Cs1tidddddtdtƒ}|dhdd 6ƒ}t|ƒd jpt‚|iƒ pt‚tidddddtƒ}|dhdd 6ƒ}t|ƒd jpt‚|iƒpt‚tidddddtƒ}|dhdd 6ƒ}t|ƒd jpt‚|iƒpt‚dS( NRs$fooR(tunique58tcacheCompilationResultstkeepRefToGeneratedCodeRiÒRR(RR tFalseR R tgeneratedModuleCodeR(R R RRR((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_keepRefToGeneratedCodeArg}s&   cCstidddddtƒ}|dhdd6ƒ}t|ƒd jpt‚|i pt‚tidddddtƒ}|dhdd6ƒ}t|ƒd jpt‚|ipt‚tidddd ƒ}|dhdd6ƒ}t|ƒd jpt‚|ipt‚dS( NRs$fooR(t unique111R8RiÒRRt unique999099(RR R:R R t_CHEETAH_isInCompilationCacheR(R R R((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_compilationCache—s"   ( RRt__doc__RRR'R*R/R3R6R<R@(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRs        tClassMethods_subclasscBseZd„ZRS(cCsÇtidddtƒ}|hdd6ƒ}t|ƒdjpt‚|iddƒ}|hdd6ƒ}t|ƒdjpt‚|iddƒ}|hdd6ƒ}t|ƒdjpt‚dS(NRs$fooRiÒRRs#implements dummy $bar(RR RR R tsubclass(R R RRR((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyR²s(RRR(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRB°st PreprocessorscBs,eZd„Zd„Zd„Zd„ZRS(cCsd}dig}|iƒD]}||iƒq~ƒ}hdd6hdd6d6}ti|d|ƒ}t|ƒƒd jpt‚dS( Ns3 %set foo = @a $(@foo*10) @as s@ %ttokensictaRt preprocessorss990 99(tjoint splitlineststripRR R R (R tsrct_[1]tlnRGR ((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_basicUsage1Âs 6 c Csd}ddd„ƒY}|ƒ}ddkl}ti|ƒ}||ƒ}d„}dtfd„ƒY}hd d 6d d 6d d6}x‚dhdd6h|d6h|d6hd6hdd6|d6|||gD]8} ti|d| ƒ} t| ƒƒdjpt‚qÐWdS(Ns"%set foo = 12 %%comment $(@foo*10)t Settings1cBseZdZRS(s@ %(RRRE(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyROÑsiÿÿÿÿ(tTemplatePreprocessorcSsdS(Ns$(12*10)(s$(12*10)N(tNone(Rtfile((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyt preprocFuncØstTemplateSubclasscBseZRS((RR(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRTÛst@tcheetahVarStartTokent%tdirectiveStartTokens%%tcommentStartTokens@ %REtcompilerSettingsttemplateInitArgsttemplateAPIClassRGt120((tCheetah.TemplateRPRt_normalizePreprocessorSettingsR R R ( R RKRORPtsettingst preprocObjRSRTRZtargR ((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyt%test_normalizePreprocessorArgVariantsÎs0         cCs¹d}dig}|iƒD]}||iƒq~ƒ}xvhdd6hdd6d6hdd6hdd6d6gD]>}ti|d|ƒ}|ƒ}t|ƒd jpt‚qsWdS( Nsž %set foo = @a %def func1: #def func(arg): $arg("***") %% comment $(@foo*10) @func1 $func(lambda x:c"--$x--@a")s s@ %REicRFRRGs 990 --***--99(RHRIRJRR R R (R RKRLRMRbR R((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_complexUsageós6 cCsd}dig}|iƒD]}||iƒq~ƒ}ti|dddtƒ}|hdd6ƒ}t|ƒdd d jpt‚dS( Ns %i18n: This is a $string that needs translation %i18n id="foo", domain="root": This is a $string that needs translation s RGs@ %Rs bit of texttstrings-This is a bit of text that needs translation iiÿÿÿÿ(RHRIRJRR RR R (R RKRLRMR R((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyt test_i18ns 6(RRRNRcRdRf(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRDÀs % tTryExceptImportTestcBseZd„ZRS(cCs?d}tid|dhtd6ƒ}|dhdd6ƒ}dS( sE Test situation where an inline #import statement will get relocated sý #def myFunction() Ahoy! #try #import sys #except ImportError $print "This will never happen!" #end try #end def RRZtuseLegacyImportModeRiÒRN(RR R:(R RR R((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyt test_FailCases (RRRi(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRgstClassMethodSupportcBseZd„ZRS(cCs¦tiddjotiddjo dGHdSd}tid|ƒ}y3|idd ƒ}|d jpt|d f‚Wn"tj o}|i|ƒnXdS( NiiiisAThis version of Python doesn't support decorators, skipping testss„ #@classmethod #def myClassMethod() #return '$foo = %s' % $foo #end def RRtbars $foo = bars3Template class method didn't return what I expected(Rt version_infoRR t myClassMethodR tAttributeErrortfail(R ttemplatetrctex((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyttest_BasicDecorator%s(!(RRRs(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRj$stStaticMethodSupportcBseZd„ZRS(cCs¦tiddjotiddjo dGHdSd}tid|ƒ}y3|idd ƒ}|d jpt|d f‚Wn"tj o}|i|ƒnXdS( NiiiisAThis version of Python doesn't support decorators, skipping testss† #@staticmethod #def myStaticMethod() #return '$foo = %s' % $foo #end def RRRks $foo = bars3Template class method didn't return what I expected(RRlRR tmyStaticMethodR RnRo(R RpRqRr((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRs7s(!(RRRs(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRt6stUselesscBseZd„ZRS(cCs dddgS(Niii((R ((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pytboinkIs(RRRw(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRvHstMultipleInheritanceSupportcBseZd„ZRS(cCstd}ti|dhtd6dhtd6ƒ}|ƒ}|iƒ}|dddd d gjpt|d f‚dS( Ns… #extends Template, Useless #def foo() #return [4,5] + $boink() #end def R4RvRZtautoImportForExtendsDirectiveiiiiisUnexpected result(RR RvR:RR (R Rptresult((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pytrunTestMs    (RRR{(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyRxLst__main__(tpdbRttypesRtos.pathRR#tunittestR^RRltmajorVertminorVerRtTestCaseRRRBRDRgRjRttobjectRvRxRtmain(((s</usr/lib64/python2.6/site-packages/Cheetah/Tests/Template.pyts*         žS