mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Made FieldError/FieldDoesNotExist messages uniform across Python versions.
Removed possible u'' prefixes on Python 2.
This commit is contained in:
parent
9027e6c8a3
commit
631ef6b272
5 changed files with 9 additions and 11 deletions
|
|
@ -237,7 +237,7 @@ class NonAggregateAnnotationTestCase(TestCase):
|
|||
self.assertEqual(book.sum_rating, book.rating)
|
||||
|
||||
def test_filter_wrong_annotation(self):
|
||||
with six.assertRaisesRegex(self, FieldError, "Cannot resolve keyword .*"):
|
||||
with self.assertRaisesMessage(FieldError, "Cannot resolve keyword 'nope' into field."):
|
||||
list(Book.objects.annotate(
|
||||
sum_rating=Sum('rating')
|
||||
).filter(sum_rating=F('nope')))
|
||||
|
|
@ -307,7 +307,7 @@ class NonAggregateAnnotationTestCase(TestCase):
|
|||
self.assertEqual(book.rating, 5)
|
||||
self.assertEqual(book.other_rating, 4)
|
||||
|
||||
with six.assertRaisesRegex(self, FieldDoesNotExist, "\w has no field named u?'other_rating'"):
|
||||
with self.assertRaisesMessage(FieldDoesNotExist, "Book has no field named 'other_rating'"):
|
||||
book = qs.defer('other_rating').get(other_rating=4)
|
||||
|
||||
def test_mti_annotations(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue