summaryrefslogtreecommitdiff
path: root/tests/annotations/tests.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2014-11-16 02:05:54 +0100
committerSimon Charette <charette.s@gmail.com>2014-11-16 02:12:36 +0100
commit68ef44c565d901945eb74768d439c93678315cf6 (patch)
tree344b6ff1ae9b57b6cae465f460fabe0d4958901e /tests/annotations/tests.py
parent5b9470efd8725eb349e6f3a66b0ea1073ede5b47 (diff)
Removed references to the deprecated assertRaisesRegexp method.
Diffstat (limited to 'tests/annotations/tests.py')
-rw-r--r--tests/annotations/tests.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index afc23b85df..b0886266f6 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -9,6 +9,7 @@ from django.db.models import (
IntegerField, BooleanField, CharField)
from django.db.models.fields import FieldDoesNotExist
from django.test import TestCase
+from django.utils import six
from .models import Author, Book, Store, DepartmentStore, Company, Employee
@@ -75,7 +76,7 @@ class NonAggregateAnnotationTestCase(TestCase):
self.assertEqual(book.sum_rating, book.rating)
def test_filter_wrong_annotation(self):
- with self.assertRaisesRegexp(FieldError, "Cannot resolve keyword .*"):
+ with six.assertRaisesRegex(self, FieldError, "Cannot resolve keyword .*"):
list(Book.objects.annotate(
sum_rating=Sum('rating')
).filter(sum_rating=F('nope')))
@@ -137,7 +138,7 @@ class NonAggregateAnnotationTestCase(TestCase):
self.assertEqual(book.rating, 5)
self.assertEqual(book.other_rating, 4)
- with self.assertRaisesRegexp(FieldDoesNotExist, "\w has no field named u?'other_rating'"):
+ with six.assertRaisesRegex(self, FieldDoesNotExist, "\w has no field named u?'other_rating'"):
book = qs.defer('other_rating').get(other_rating=4)
def test_mti_annotations(self):