ó ú…abc@s&ddlZddlZddlZddlZejdejdZZeefZd„Z de fd„ƒYZ de fd„ƒYZ d ejfd „ƒYZd ejfd „ƒYZd ejfd„ƒYZdejfd„ƒYZdejfd„ƒYZedkr"ejƒndS(iÿÿÿÿNiicCstdkotdkS(sJ Python 2.3 is still supported by Cheetah, but doesn't support decorators ii(tmajorVertminorVer(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyt isPython23 stGetAttrExceptioncBseZRS((t__name__t __module__(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyRstCustomGetAttrClasscBseZd„ZRS(cCstd|ƒ‚dS(NsFAIL, %s(R(tselftname((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyt __getattr__s(RRR (((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyRst GetAttrTestcBs eZdZd„Zd„ZRS(sŠ Test for an issue occurring when __getatttr__() raises an exception causing NameMapper to raise a NotFound exception cCsTtƒ}y |jGHWn+tk r+}dS|jd|ƒnX|jdƒdS(NsInvalid exception raised: %ss#Should have had an exception raised(RtattrRtfail(Rtote((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_ValidExceptions  cCsZd}tjjj|didtƒ}|ditƒd6gƒ}|jt|jƒdS(NsJ #def raiseme() $obj.attr #end deftcompilerSettingstkeepRefToGeneratedCodet searchListtobj(tCheetahtTemplatetcompiletTrueRtfailUnlessRaisesRtraiseme(Rttemplate((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_NotFoundException's!(RRt__doc__RR(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR s tInlineImportTestcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCsPd}tjjj|ditd6dtƒ}|digƒ}|jƒ}dS(sÔ Verify that a bug introduced in v2.1.0 where an inline: #from module import class would result in the following code being generated: import class sÐ #def myfunction() #if True #from os import path #return 17 Hello! #end if #end def RtuseLegacyImportModeRRN(RRRtFalseRt myfunction(RRtrc((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_FromFooImportThing5s ( cCsDd}tjjj|ditd6dtƒ}|digƒ}dS(Ns¿ #try #import invalidmodule #except #set invalidmodule = dict(FOO='BAR!') #end try $invalidmodule.FOO RRRR(RRRRR(RR((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_ImportFailModuleMs (cCs9d}|jttjjj|ditd6dtƒdS(Nsf #from invalid import fail This should totally $fail RRR(Rt ImportErrorRRRRR(RR((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_ProperImportOfBadModule]scCs&d}|jttjjj|ƒdS(Ns> #extends FakeyTemplate Boo! (RR$RRR(RR((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_AutoImportingescCs9d}|jttjjj|ditd6dtƒdS(Ns< ### ### I like comments before import ### #extends Foo Bar RRR(RR$RRRR(RR((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_StuffBeforeImport_Legacyms(RRR"R#R%R&R'(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR4s     tMantis_Issue_11_Regression_TestcBs eZdZd„Zd„ZRS(s— Test case for bug outlined in Mantis issue #11: Output: Traceback (most recent call last): File "test.py", line 12, in t.respond() File "DynamicallyCompiledCheetahTemplate.py", line 86, in respond File "/usr/lib64/python2.6/cgi.py", line 1035, in escape s = s.replace("&", "&") # Must be done first! cCsOddl}tjjddi|jd6dd6gƒ}|jt|jƒdS(Niÿÿÿÿs$escape($request)Rtescapetfoobartrequest(tcgiRRR)RtAttributeErrortrespond(RR,R((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_FailingBehavior„s ,cCsIddl}tjjddi|jd6dd6gditd6ƒ}dS( Niÿÿÿÿs$escape($request)RR)R*R+RtprioritizeSearchListOverSelf(R,RRR)R(RR,R((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_FailingBehaviorWithSetting‹s  (RRRR/R1(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR(xs  tMantis_Issue_21_Regression_TestcBseZdZd„ZRS(sò Test case for bug outlined in issue #21 Effectively @staticmethod and @classmethod decorated methods in templates don't properly define the _filter local, which breaks when using the NameMapper cCs,tƒr dSd}tjjj|ƒ}dS(Nsz #@staticmethod #def testMethod() This is my $output #end def (RRRR(RR((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pytrunTestœs  (RRRR3(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR2“stMantis_Issue_22_Regression_TestcBs eZdZd„Zd„ZRS(s Test case for bug outlined in issue #22 When using @staticmethod and @classmethod in conjunction with the #filter directive the generated code for the #filter is reliant on the `self` local, breaking the function cCs0dStƒrdSd}tjjj|ƒ}dS(Ns· #@staticmethod #def testMethod() #filter None This is my $output #end filter #end def (RRRR(RR((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_NoneFilter³s  cCs0dStƒrdSd}tjjj|ƒ}dS(Ns¹ #@staticmethod #def testMethod() #filter Filter This is my $output #end filter #end def (RRRR(RR((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_DefinedFilterÄs   (RRRR5R6(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR4ªs t__main__(tCheetah.NameMapperRtCheetah.Templatetsystunittestt version_infoRRt versionTupleRt ExceptionRtobjectRtTestCaseR RR(R2R4Rtmain(((s?/usr/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyts      DK