diff options
Diffstat (limited to 'tests/distinct_on_fields')
| -rw-r--r-- | tests/distinct_on_fields/tests.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/distinct_on_fields/tests.py b/tests/distinct_on_fields/tests.py index 6bb518d2b1..93a332cf83 100644 --- a/tests/distinct_on_fields/tests.py +++ b/tests/distinct_on_fields/tests.py @@ -97,16 +97,18 @@ class DistinctOnTests(TestCase): def test_distinct_not_implemented_checks(self): # distinct + annotate not allowed - with self.assertRaises(NotImplementedError): + msg = 'annotate() + distinct(fields) is not implemented.' + with self.assertRaisesMessage(NotImplementedError, msg): Celebrity.objects.annotate(Max('id')).distinct('id')[0] - with self.assertRaises(NotImplementedError): + with self.assertRaisesMessage(NotImplementedError, msg): Celebrity.objects.distinct('id').annotate(Max('id'))[0] # However this check is done only when the query executes, so you # can use distinct() to remove the fields before execution. Celebrity.objects.distinct('id').annotate(Max('id')).distinct()[0] # distinct + aggregate not allowed - with self.assertRaises(NotImplementedError): + msg = 'aggregate() + distinct(fields) not implemented.' + with self.assertRaisesMessage(NotImplementedError, msg): Celebrity.objects.distinct('id').aggregate(Max('id')) def test_distinct_on_in_ordered_subquery(self): |
