diff options
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 6ff57c2cf5..7ae72c83f4 100644 --- a/tests/template_tests/test_parser.py +++ b/tests/template_tests/test_parser.py @@ -44,7 +44,8 @@ class ParserTests(TestCase): # Filtered variables should reject access of attributes beginning with # underscores. - self.assertRaises(TemplateSyntaxError, FilterExpression, "article._hidden|upper", p) + with self.assertRaises(TemplateSyntaxError): + FilterExpression("article._hidden|upper", p) def test_variable_parsing(self): c = {"article": {"section": "News"}} @@ -67,7 +68,8 @@ class ParserTests(TestCase): # Variables should reject access of attributes beginning with # underscores. - self.assertRaises(TemplateSyntaxError, Variable, "article._hidden") + with self.assertRaises(TemplateSyntaxError): + Variable("article._hidden") # Variables should raise on non string type with six.assertRaisesRegex(self, TypeError, "Variable must be a string or number, got <(class|type) 'dict'>"): |