| Server IP : 142.11.234.102 / Your IP : 216.73.217.70 Web Server : Apache System : Linux dal-shared-66.hostwindsdns.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : krnuyqrm ( 1183) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/lib64/python2.7/site-packages/Cheetah/Tests/ |
Upload File : |
# import unittest
import Cheetah
import Cheetah.Parser
import Cheetah.Template
# class Chep_2_Conditionalized_Import_Behavior(unittest.TestCase):
class Chep_2_Conditionalized_Import_Behavior():
def test_ModuleLevelImport(self):
''' Verify module level (traditional) import behavior '''
pass
def test_InlineImport(self):
''' Verify (new) inline import behavior works '''
template = '''
#def funky($s)
#try
#import urllib
#except ImportError
#pass
#end try
#return urllib.quote($s)
#end def
'''
try:
template = Cheetah.Template.Template.compile(template)
except Cheetah.Parser.ParseError as ex:
self.fail('Failed to properly generate code %s' % ex)
template = template()
rc = template.funky('abc def')
assert rc == 'abc+def'
def test_LegacyMode(self):
''' Verify disabling of CHEP #2 works '''
pass