summaryrefslogtreecommitdiff
path: root/tests/annotations
diff options
context:
space:
mode:
authorFrançois Freitag <francois.freitag@gmail.com>2016-09-17 06:29:14 -0700
committerTim Graham <timograham@gmail.com>2016-09-17 09:29:14 -0400
commit631ef6b2729f79c75f35cd32caa504dda7c32e9e (patch)
treea965597f3c1260ef2e956fafcf46a9b0e8727f91 /tests/annotations
parent9027e6c8a3711034d345535036d1a276d9a8b829 (diff)
Made FieldError/FieldDoesNotExist messages uniform across Python versions.
Removed possible u'' prefixes on Python 2.
Diffstat (limited to 'tests/annotations')
-rw-r--r--tests/annotations/tests.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index 28627e84ae..ad2f071fa4 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -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):