"Fossies" - the Fresh Open Source Software Archive

Member "cheetah3-3.2.6.post2/Cheetah/Tests/Cheps.py" (20 Apr 2021, 1062 Bytes) of package /linux/www/cheetah3-3.2.6.post2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "Cheps.py": 3-3.2.2_vs_3-3.2.3.

    1 # import unittest
    2 
    3 import Cheetah
    4 import Cheetah.Parser
    5 import Cheetah.Template
    6 
    7 
    8 # class Chep_2_Conditionalized_Import_Behavior(unittest.TestCase):
    9 class Chep_2_Conditionalized_Import_Behavior():
   10     def test_ModuleLevelImport(self):
   11         ''' Verify module level (traditional) import behavior '''
   12         pass
   13 
   14     def test_InlineImport(self):
   15         ''' Verify (new) inline import behavior works '''
   16         template = '''
   17             #def funky($s)
   18                 #try
   19                     #import urllib
   20                 #except ImportError
   21                     #pass
   22                 #end try
   23                 #return urllib.quote($s)
   24             #end def
   25         '''
   26         try:
   27             template = Cheetah.Template.Template.compile(template)
   28         except Cheetah.Parser.ParseError as ex:
   29             self.fail('Failed to properly generate code %s' % ex)
   30         template = template()
   31         rc = template.funky('abc def')
   32         assert rc == 'abc+def'
   33 
   34     def test_LegacyMode(self):
   35         ''' Verify disabling of CHEP #2 works '''
   36         pass