From c00ae7f58c34962ed6dbec4eb8aaf747da59ed2f Mon Sep 17 00:00:00 2001 From: Preston Timmons Date: Thu, 21 Jan 2016 21:50:06 -0600 Subject: Fixed #26118 -- Added 'is' operator to if template tag. --- tests/template_tests/syntax_tests/test_if.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/template_tests/syntax_tests') diff --git a/tests/template_tests/syntax_tests/test_if.py b/tests/template_tests/syntax_tests/test_if.py index 92b3f16351..507a26b0b7 100644 --- a/tests/template_tests/syntax_tests/test_if.py +++ b/tests/template_tests/syntax_tests/test_if.py @@ -527,3 +527,13 @@ class IfTagTests(SimpleTestCase): # A single equals sign is a syntax error. with self.assertRaises(TemplateSyntaxError): self.engine.render_to_string('if-tag-single-eq', {'foo': 1}) + + @setup({'template': '{% if foo is True %}yes{% else %}no{% endif %}'}) + def test_if_is_match(self): + output = self.engine.render_to_string('template', {'foo': True}) + self.assertEqual(output, 'yes') + + @setup({'template': '{% if foo is True %}yes{% else %}no{% endif %}'}) + def test_if_is_no_match(self): + output = self.engine.render_to_string('template', {'foo': 1}) + self.assertEqual(output, 'no') -- cgit v1.3