Permalink
Browse files

Add Cheps.py test module

  • Loading branch information...
1 parent c7da1e0 commit 9bc0b37a331290c829efa6365da7455aa8bde6d9 @rtyler committed Aug 31, 2009
Showing with 39 additions and 0 deletions.
  1. +39 −0 cheetah/Tests/Cheps.py
View
@@ -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()

0 comments on commit 9bc0b37

Please sign in to comment.