summaryrefslogtreecommitdiff
path: root/cheetah
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@monkeypox.org>2009-08-31 11:57:05 -0700
committerR. Tyler Ballance <tyler@monkeypox.org>2009-08-31 11:57:05 -0700
commit9bc0b37a331290c829efa6365da7455aa8bde6d9 (patch)
treea25dbc56f72534e0189a22318d696f774af7b220 /cheetah
parentc7da1e012425c3fd53b86f9a67351bce21c2b9cd (diff)
downloadpython-cheetah-9bc0b37a331290c829efa6365da7455aa8bde6d9.tar.gz
Add Cheps.py test module
Diffstat (limited to 'cheetah')
-rw-r--r--cheetah/Tests/Cheps.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/cheetah/Tests/Cheps.py b/cheetah/Tests/Cheps.py
new file mode 100644
index 0000000..7918435
--- /dev/null
+++ b/cheetah/Tests/Cheps.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+import unittest
+
+import Cheetah
+import Cheetah.Parser
+import Cheetah.Template
+
+class Chep_2_Conditionalized_Import_Behavior(unittest.TestCase):
+ 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, ex:
+ self.fail('Failed to properly generate code %s' % ex)
+ template = template()
+ rc = tepmlate.funky('abc def')
+ assert rc == 'abc+def'
+
+ def test_LegacyMode(self):
+ ''' Verify disabling of CHEP #2 works '''
+ pass
+
+if __name__ == '__main__':
+ unittest.main()