aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_template.py
diff options
context:
space:
mode:
authorBenjamin Trofatter <bentrofatter@gmail.com>2012-11-09 14:55:01 -0600
committerBenjamin Trofatter <bentrofatter@gmail.com>2012-11-09 14:55:01 -0600
commit38cd2bb4cb2958193010634d1614919a5e07dbe3 (patch)
tree4e548e247a00cf2e4caa3324437754871bf040b8 /test/test_template.py
parentd9e3e8c91c7bfaad2a4a7e131168dbf70e9437c1 (diff)
downloadexternal_python_mako-38cd2bb4cb2958193010634d1614919a5e07dbe3.tar.gz
external_python_mako-38cd2bb4cb2958193010634d1614919a5e07dbe3.tar.bz2
external_python_mako-38cd2bb4cb2958193010634d1614919a5e07dbe3.zip
Added futures support to mako
Provide a list of names to import from __future__ to Template or TemplateLookup, and it will render the import from __future__ statement at the top of the generated code so that it actually works.
Diffstat (limited to 'test/test_template.py')
-rw-r--r--test/test_template.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_template.py b/test/test_template.py
index 03bcf09..e6fa3c6 100644
--- a/test/test_template.py
+++ b/test/test_template.py
@@ -1240,3 +1240,10 @@ class PreprocessTest(TemplateTest):
""", preprocessor=convert_comments)
assert flatten_result(t.render()) == "im a template - # not a comment - ## not a comment"
+
+
+class FuturesTest(TemplateTest):
+
+ def test_future_import(self):
+ t = Template("${ x / y }", futures=["division"])
+ assert result_lines(t.render(x=12, y=5)) == ["2.4"]