from django.template import Context, Template, Variable, VariableDoesNotExist from django.test import SimpleTestCase from django.utils.translation import gettext_lazy class TemplateTests(SimpleTestCase): def test_lazy_template_string(self): template_string = gettext_lazy('lazy string') self.assertEqual(Template(template_string).render(Context()), template_string) def test_repr(self): template = Template( '\n' '{% if test %}

{{ varvalue }}

{% endif %}' '' ) self.assertEqual( repr(template), '