From: Armin Ronacher Date: Wed, 13 Jan 2010 23:54:47 +0000 (+0100) Subject: Fixed the choice include tests. X-Git-Tag: 2.3~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e40df0f7a97fb22510c978226b4ab6bd953fbec;p=thirdparty%2Fjinja.git Fixed the choice include tests. --HG-- branch : trunk --- diff --git a/jinja2/exceptions.py b/jinja2/exceptions.py index 96194a9c..acb26dbb 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 12545d50..c217eabd 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" %}')