mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +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
|
@ -37,7 +37,11 @@ class CustomColumnsTests(TestCase):
|
|||
)
|
||||
|
||||
def test_field_error(self):
|
||||
with self.assertRaises(FieldError):
|
||||
msg = (
|
||||
"Cannot resolve keyword 'firstname' into field. Choices are: "
|
||||
"Author_ID, article, first_name, last_name, primary_set"
|
||||
)
|
||||
with self.assertRaisesMessage(FieldError, msg):
|
||||
Author.objects.filter(firstname__exact="John")
|
||||
|
||||
def test_attribute_error(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue