summaryrefslogtreecommitdiff
path: root/tests/template_tests/syntax_tests/test_basic.py
diff options
context:
space:
mode:
authorDave Smith <dsmith@hirevue.com>2015-09-10 21:05:00 -0600
committerTim Graham <timograham@gmail.com>2015-09-15 12:25:13 -0400
commitb53b4d5c107dbd56386c599582f46c522877a651 (patch)
tree422e60fa254a59be72a122cf7d6ee2dc933a1bb7 /tests/template_tests/syntax_tests/test_basic.py
parentd731cf5caf043189fda3708cc0dace5d8f94db6b (diff)
Fixed #25404 -- Added line numbers to TemplateSyntaxError strings.
This makes it much easier to diagnose a test failure when all you have is the stack trace from an uncaught TemplateSyntaxError.
Diffstat (limited to 'tests/template_tests/syntax_tests/test_basic.py')
-rw-r--r--tests/template_tests/syntax_tests/test_basic.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/template_tests/syntax_tests/test_basic.py b/tests/template_tests/syntax_tests/test_basic.py
index da45fe2839..0a1c10cee8 100644
--- a/tests/template_tests/syntax_tests/test_basic.py
+++ b/tests/template_tests/syntax_tests/test_basic.py
@@ -61,7 +61,7 @@ class BasicSyntaxTests(SimpleTestCase):
"""
Raise TemplateSyntaxError for empty variable tags.
"""
- with self.assertRaises(TemplateSyntaxError):
+ with self.assertRaisesMessage(TemplateSyntaxError, 'Empty variable tag on line 1'):
self.engine.get_template('basic-syntax07')
@setup({'basic-syntax08': '{{ }}'})
@@ -69,7 +69,7 @@ class BasicSyntaxTests(SimpleTestCase):
"""
Raise TemplateSyntaxError for empty variable tags.
"""
- with self.assertRaises(TemplateSyntaxError):
+ with self.assertRaisesMessage(TemplateSyntaxError, 'Empty variable tag on line 1'):
self.engine.get_template('basic-syntax08')
@setup({'basic-syntax09': '{{ var.method }}'})
@@ -314,13 +314,13 @@ class BasicSyntaxTests(SimpleTestCase):
@setup({'template': '{% block content %}'})
def test_unclosed_block(self):
- msg = "Unclosed tag 'block'. Looking for one of: endblock."
+ msg = "Unclosed tag on line 1: 'block'. Looking for one of: endblock."
with self.assertRaisesMessage(TemplateSyntaxError, msg):
self.engine.render_to_string('template')
@setup({'template': '{% if a %}'})
def test_unclosed_block2(self):
- msg = "Unclosed tag 'if'. Looking for one of: elif, else, endif."
+ msg = "Unclosed tag on line 1: 'if'. Looking for one of: elif, else, endif."
with self.assertRaisesMessage(TemplateSyntaxError, msg):
self.engine.render_to_string('template')