summaryrefslogtreecommitdiff
path: root/tests/template_tests/tests.py
diff options
context:
space:
mode:
authorPindi Albert <pindi.albert@gmail.com>2015-10-04 10:50:18 -0700
committerTim Graham <timograham@gmail.com>2015-10-05 17:21:35 -0400
commit9f2881deb127593e8e0fa25e978aad9029d7b562 (patch)
tree98ac917dbfdb293d2beed87bbf975ee5909c5904 /tests/template_tests/tests.py
parent287532588941d2941e19c4cd069bcbd8af889203 (diff)
Fixed #25423 -- Made error message for unknown template tag more helpful.
Diffstat (limited to 'tests/template_tests/tests.py')
-rw-r--r--tests/template_tests/tests.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index a6aac5b81a..38d7eaa8bb 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -68,14 +68,21 @@ class TemplateTests(SimpleTestCase):
#7876 -- Error messages should include the unexpected block name.
"""
engine = Engine()
-
- with self.assertRaises(TemplateSyntaxError) as e:
+ msg = (
+ "Invalid block tag on line 1: 'endblock', expected 'elif', 'else' "
+ "or 'endif'. Did you forget to register or load this tag?"
+ )
+ with self.assertRaisesMessage(TemplateSyntaxError, msg):
engine.from_string("{% if 1 %}lala{% endblock %}{% endif %}")
- self.assertEqual(
- e.exception.args[0],
- "Invalid block tag on line 1: 'endblock', expected 'elif', 'else' or 'endif'",
+ def test_unknown_block_tag(self):
+ engine = Engine()
+ msg = (
+ "Invalid block tag on line 1: 'foobar'. Did you forget to "
+ "register or load this tag?"
)
+ with self.assertRaisesMessage(TemplateSyntaxError, msg):
+ engine.from_string("lala{% foobar %}")
def test_compile_filter_expression_error(self):
"""