mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Used assertRaisesMessage() to test Django's error messages.
This commit is contained in:
parent
38988f289f
commit
a51c4de194
69 changed files with 448 additions and 173 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue