summaryrefslogtreecommitdiff
path: root/tests/template_tests/test_base.py
blob: 9ab8c4e6c65b6d637b36d05699513182bdc65fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from django.template import Context, Template, 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)


class VariableDoesNotExistTests(SimpleTestCase):
    def test_str(self):
        exc = VariableDoesNotExist(msg='Failed lookup in %r', params=({'foo': 'bar'},))
        self.assertEqual(str(exc), "Failed lookup in {'foo': 'bar'}")