mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #26022 -- Used context manager version of assertRaises in tests.
This commit is contained in:
@@ -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'>"):
|
||||
|
||||
Reference in New Issue
Block a user