Fixed the choice include tests.
authorArmin Ronacher <armin.ronacher@active-4.com>
Wed, 13 Jan 2010 23:54:47 +0000 (00:54 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Wed, 13 Jan 2010 23:54:47 +0000 (00:54 +0100)
--HG--
branch : trunk

jinja2/exceptions.py
tests/test_imports.py

index 96194a9cb7a1aa9b0119bb1f40c8f1f7ebb1ecaa..acb26dbb558a0d9bd2bf6b1ff41f3c3544b1ffae 100644 (file)
@@ -59,7 +59,7 @@ class TemplatesNotFound(TemplateNotFound):
     def __init__(self, names=(), message=None):
         if message is None:
             message = u'non of the templates given were found: ' + \
-                      u', '.join(names)
+                      u', '.join(map(unicode, names))
         TemplateNotFound.__init__(self, names and names[-1] or None, message)
         self.templates = list(names)
 
index 12545d5012c1f38b56fe630d748a65959d446fdb..c217eabd544350247bc6534199b17066b4621c5f 100644 (file)
@@ -61,6 +61,17 @@ def test_choice_includes():
     else:
         assert False, 'thou shalt raise'
 
+    def test_includes(t, **ctx):
+        ctx['foo'] = 42
+        assert t.render(ctx) == '[42|23]'
+
+    t = test_env.from_string('{% include ["missing", "header"] %}')
+    test_includes(t)
+    t = test_env.from_string('{% include x %}')
+    test_includes(t, x=['missing', 'header'])
+    t = test_env.from_string('{% include [x, "header"] %}')
+    test_includes(t, x='missing')
+
 
 def test_include_ignoring_missing():
     t = test_env.from_string('{% include "missing" %}')