From 7e40df0f7a97fb22510c978226b4ab6bd953fbec Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 14 Jan 2010 00:54:47 +0100 Subject: [PATCH] Fixed the choice include tests. --HG-- branch : trunk --- jinja2/exceptions.py | 2 +- tests/test_imports.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/jinja2/exceptions.py b/jinja2/exceptions.py index 96194a9..acb26db 100644 --- a/jinja2/exceptions.py +++ b/jinja2/exceptions.py @@ -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) diff --git a/tests/test_imports.py b/tests/test_imports.py index 12545d5..c217eab 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -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" %}') -- 2.26.2