summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests
diff options
context:
space:
mode:
authorPreston Timmons <preston.timmons@rewardstyle.com>2016-01-21 21:50:06 -0600
committerTim Graham <timograham@gmail.com>2016-01-22 15:35:28 -0500
commitc00ae7f58c34962ed6dbec4eb8aaf747da59ed2f (patch)
treeb3985f7262b60ff43ca6f0e7bc4c84b2d25a915e /tests/template_tests/syntax_tests
parenta08d2463d2674b95f5a995f77cd9596168378a4f (diff)
Fixed #26118 -- Added 'is' operator to if template tag.
Diffstat (limited to 'tests/template_tests/syntax_tests')
-rw-r--r--tests/template_tests/syntax_tests/test_if.py10
1 files changed, 10 insertions, 0 deletions
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')