summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@slide.com>2009-09-01 14:18:18 -0700
committerR. Tyler Ballance <tyler@slide.com>2009-09-01 14:18:18 -0700
commit3de1ca853362f7f56e78a7da9add6b6409b2797a (patch)
treeac4f6c90be6abfa5450397571026eb4b8a1e22b4
parent9f172d3d7d1e24109332e2b22697887414217a3a (diff)
parent8bb8f0f2c9c06578987bf4ceb2d25c3b7cb0e0b7 (diff)
downloadpython-cheetah-3de1ca853362f7f56e78a7da9add6b6409b2797a.tar.gz
Merge commit 'origin/next' into next
-rw-r--r--SetupConfig.py2
-rw-r--r--cheetah/Tests/Cheps.py39
2 files changed, 40 insertions, 1 deletions
diff --git a/SetupConfig.py b/SetupConfig.py
index 3848f22..61e304d 100644
--- a/SetupConfig.py
+++ b/SetupConfig.py
@@ -51,7 +51,7 @@ scripts = ['bin/cheetah-compile',
'bin/cheetah',
]
-data_files = ['recursive: src *.tmpl *.txt LICENSE README TODO CHANGES',]
+data_files = ['recursive: cheetah *.tmpl *.txt LICENSE README TODO CHANGES',]
if not os.getenv('CHEETAH_INSTALL_WITHOUT_SETUPTOOLS'):
try:
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()