Ticket #32157: test-32157.diff

File test-32157.diff, 1.1 KB (added by Mariusz Felisiak, 4 years ago)

Tests.

  • tests/template_tests/syntax_tests/test_if.py

    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 b class IfTagTests(SimpleTestCase):  
    591591        output = self.engine.render_to_string('template', {'foo': None})
    592592        self.assertEqual(output, 'no')
    593593
     594    @setup({'template': '{% if x is None %}print None{% endif %}{% if x == "" %}print empty{% endif %}'})
     595    def test_if_none_x(self):
     596        output = self.engine.render_to_string('template', {'x': None})
     597        self.assertEqual(output, 'print None')
     598
     599    @setup({'template': '{% with x=foo %}{% if x is None %}print None{% endif %}{% if x == "" %}print empty{% endif %}{% endwith %}'})
     600    def test_if_none_x_with(self):
     601        output = self.engine.render_to_string('template', {'foo': None})
     602        self.assertEqual(output, 'print None')
     603
    594604    @setup({'template': '{% if foo is not bar %}yes{% else %}no{% endif %}'})
    595605    def test_if_is_not_variable_missing(self):
    596606        output = self.engine.render_to_string('template', {'foo': False})
Back to Top