diff options
Diffstat (limited to 'tests/template_tests/syntax_tests/test_width_ratio.py')
| -rw-r--r-- | tests/template_tests/syntax_tests/test_width_ratio.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/template_tests/syntax_tests/test_width_ratio.py b/tests/template_tests/syntax_tests/test_width_ratio.py index bec7d93a4c..7db90a44e1 100644 --- a/tests/template_tests/syntax_tests/test_width_ratio.py +++ b/tests/template_tests/syntax_tests/test_width_ratio.py @@ -142,3 +142,13 @@ class WidthRatioTagTests(SimpleTestCase): def test_widthratio21(self): output = self.engine.render_to_string('widthratio21', {'a': float('inf'), 'b': 2}) self.assertEqual(output, '') + + @setup({'t': '{% widthratio a b 100 as variable %}-{{ variable }}-'}) + def test_zerodivisionerror_as_var(self): + output = self.engine.render_to_string('t', {'a': 0, 'b': 0}) + self.assertEqual(output, '-0-') + + @setup({'t': '{% widthratio a b c as variable %}-{{ variable }}-'}) + def test_typeerror_as_var(self): + output = self.engine.render_to_string('t', {'a': 'a', 'c': 100, 'b': 100}) + self.assertEqual(output, '--') |
