diff options
| author | Mads Jensen <mje@inducks.org> | 2017-05-28 21:37:21 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-07-29 19:07:23 -0400 |
| commit | a51c4de1945be2225f20fad794cfb52d8f1f9236 (patch) | |
| tree | 36386b70a27cf027a8a491de319c3e59e0d3d0cd /tests/template_tests/test_parser.py | |
| parent | 38988f289f7f5708f5ea85de2d5dfe0d86b23106 (diff) | |
Used assertRaisesMessage() to test Django's error messages.
Diffstat (limited to 'tests/template_tests/test_parser.py')
| -rw-r--r-- | tests/template_tests/test_parser.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py index cd2f2ddc05..3dc731e0a9 100644 --- a/tests/template_tests/test_parser.py +++ b/tests/template_tests/test_parser.py @@ -40,7 +40,8 @@ class ParserTests(SimpleTestCase): # Filtered variables should reject access of attributes beginning with # underscores. - with self.assertRaises(TemplateSyntaxError): + msg = "Variables and attributes may not begin with underscores: 'article._hidden'" + with self.assertRaisesMessage(TemplateSyntaxError, msg): FilterExpression("article._hidden|upper", p) def test_variable_parsing(self): @@ -64,7 +65,8 @@ class ParserTests(SimpleTestCase): # Variables should reject access of attributes beginning with # underscores. - with self.assertRaises(TemplateSyntaxError): + msg = "Variables and attributes may not begin with underscores: 'article._hidden'" + with self.assertRaisesMessage(TemplateSyntaxError, msg): Variable("article._hidden") # Variables should raise on non string type |
