diff --git a/tests/template_tests/syntax_tests/test_if.py b/tests/template_tests/syntax_tests/test_if.py
index 711f871af9..2c7c746138 100644
--- a/tests/template_tests/syntax_tests/test_if.py
+++ b/tests/template_tests/syntax_tests/test_if.py
@@ -591,6 +591,16 @@ class IfTagTests(SimpleTestCase):
         output = self.engine.render_to_string('template', {'foo': None})
         self.assertEqual(output, 'no')
 
+    @setup({'template': '{% if x is None %}print None{% endif %}{% if x == "" %}print empty{% endif %}'})
+    def test_if_none_x(self):
+        output = self.engine.render_to_string('template', {'x': None})
+        self.assertEqual(output, 'print None')
+
+    @setup({'template': '{% with x=foo %}{% if x is None %}print None{% endif %}{% if x == "" %}print empty{% endif %}{% endwith %}'})
+    def test_if_none_x_with(self):
+        output = self.engine.render_to_string('template', {'foo': None})
+        self.assertEqual(output, 'print None')
+
     @setup({'template': '{% if foo is not bar %}yes{% else %}no{% endif %}'})
     def test_if_is_not_variable_missing(self):
         output = self.engine.render_to_string('template', {'foo': False})
