۶eTc@s&ddlZddlZddlZddlZejdejdZZeefZdZ de fdYZ de fdYZ d ejfd YZd ejfd YZd ejfdYZdejfdYZdejfdYZedkr"ejndS(iNiicCstdkotdkS(sJ Python 2.3 is still supported by Cheetah, but doesn't support decorators ii(tmajorVertminorVer(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyt isPython23 stGetAttrExceptioncBseZRS((t__name__t __module__(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyRstCustomGetAttrClasscBseZdZRS(cCstd|dS(NsFAIL, %s(R(tselftname((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyt __getattr__s(RRR (((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyRst GetAttrTestcBs eZdZdZdZRS(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|jddS(NsInvalid exception raised: %ss#Should have had an exception raised(RtattrRtfail(Rtote((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_ValidExceptions  cCsZd}tjjj|didt}|ditd6g}|jt|jdS(NsJ #def raiseme() $obj.attr #end deftcompilerSettingstkeepRefToGeneratedCodet searchListtobj(tCheetahtTemplatetcompiletTrueRtfailUnlessRaisesRtraiseme(Rttemplate((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_NotFoundException(s!(RRt__doc__RR(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR s tInlineImportTestcBs5eZdZdZdZdZdZRS(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((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_FromFooImportThing6s ( cCsDd}tjjj|ditd6dt}|dig}dS(Ns #try #import invalidmodule #except #set invalidmodule = dict(FOO='BAR!') #end try $invalidmodule.FOO RRRR(RRRRR(RR((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_ImportFailModuleNs (cCs9d}|jttjjj|ditd6dtdS(Nsf #from invalid import fail This should totally $fail RRR(Rt ImportErrorRRRRR(RR((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_ProperImportOfBadModule^scCs&d}|jttjjj|dS(Ns> #extends FakeyTemplate Boo! (RR$RRR(RR((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_AutoImportingfscCs9d}|jttjjj|ditd6dtdS(Ns< ### ### I like comments before import ### #extends Foo Bar RRR(RR$RRRR(RR((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_StuffBeforeImport_Legacyns(RRR"R#R%R&R'(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR5s     tMantis_Issue_11_Regression_TestcBs eZdZdZdZRS(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|jdS(Nis$escape($request)Rtescapetfoobartrequest(tcgiRRR)RtAttributeErrortrespond(RR,R((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_FailingBehaviors ,cCsIddl}tjjddi|jd6dd6gditd6}dS( Nis$escape($request)RR)R*R+RtprioritizeSearchListOverSelf(R,RRR)R(RR,R((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_FailingBehaviorWithSettings  (RRRR/R1(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR(ys  tMantis_Issue_21_Regression_TestcBseZdZdZRS(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,tr dSd}tjjj|}dS(Nsz #@staticmethod #def testMethod() This is my $output #end def (RRRR(RR((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pytrunTests  (RRRR3(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR2stMantis_Issue_22_Regression_TestcBs eZdZdZdZRS(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 cCs0dStrdSd}tjjj|}dS(Ns #@staticmethod #def testMethod() #filter None This is my $output #end filter #end def (RRRR(RR((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_NoneFilters  cCs0dStrdSd}tjjj|}dS(Ns #@staticmethod #def testMethod() #filter Filter This is my $output #end filter #end def (RRRR(RR((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyttest_DefinedFilters   (RRRR5R6(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyR4s t__main__(tCheetah.NameMapperRtCheetah.Templatetsystunittestt version_infoRRt versionTupleRt ExceptionRtobjectRtTestCaseR RR(R2R4Rtmain(((sH/opt/freeware/lib64/python2.7/site-packages/Cheetah/Tests/Regressions.pyts      DK