summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests
diff options
context:
space:
mode:
authorAlasdair Nicol <alasdair@thenicols.net>2016-04-09 16:25:00 +0100
committerTim Graham <timograham@gmail.com>2016-04-09 13:01:15 -0400
commitc16b9dd8e0ae757616e9accbaffecc521191ee98 (patch)
tree691989f2102021cbbbad9fb27b3a28e10fc602e3 /tests/template_tests/syntax_tests
parentc10db4bd1b069739687b99d6b32b946634237431 (diff)
Fixed #26479 -- Added 'is not' operator to the if tag.
Diffstat (limited to 'tests/template_tests/syntax_tests')
-rw-r--r--tests/template_tests/syntax_tests/test_if.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_if.py b/tests/template_tests/syntax_tests/test_if.py
index 507a26b0b7..c4b5c53250 100644
--- a/tests/template_tests/syntax_tests/test_if.py
+++ b/tests/template_tests/syntax_tests/test_if.py
@@ -537,3 +537,15 @@ class IfTagTests(SimpleTestCase):
def test_if_is_no_match(self):
output = self.engine.render_to_string('template', {'foo': 1})
self.assertEqual(output, 'no')
+
+ @setup({'template': '{% if foo is not None %}yes{% else %}no{% endif %}'})
+ def test_if_is_not_match(self):
+ # For this to act as a regression test, it's important not to use
+ # foo=True because True is (not None)
+ output = self.engine.render_to_string('template', {'foo': False})
+ self.assertEqual(output, 'yes')
+
+ @setup({'template': '{% if foo is not None %}yes{% else %}no{% endif %}'})
+ def test_if_is_not_no_match(self):
+ output = self.engine.render_to_string('template', {'foo': None})
+ self.assertEqual(output, 'no')