mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #26573 -- Added descriptive error message for malformed if/else/elif template tags.
This commit is contained in:
parent
ff6c6feae1
commit
93c312cc9c
2 changed files with 8 additions and 1 deletions
|
@ -508,6 +508,12 @@ class IfTagTests(SimpleTestCase):
|
|||
with self.assertRaises(TemplateSyntaxError):
|
||||
self.engine.get_template('if-tag-error12')
|
||||
|
||||
@setup({'else-if-tag-error01': '{% if foo is bar %} yes {% else if foo is not bar %} no {% endif %}'})
|
||||
def test_else_if_tag_error01(self):
|
||||
error_message = 'Malformed template tag at line 1: "else if foo is not bar"'
|
||||
with self.assertRaisesMessage(TemplateSyntaxError, error_message):
|
||||
self.engine.get_template('else-if-tag-error01')
|
||||
|
||||
@setup({'if-tag-shortcircuit01': '{% if x.is_true or x.is_bad %}yes{% else %}no{% endif %}'})
|
||||
def test_if_tag_shortcircuit01(self):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue