summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/aggregation/tests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index bd6ecf699c..7e0436cdfc 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -388,9 +388,6 @@ class AggregateTestCase(TestCase):
vals = Book.objects.aggregate(Count("rating"))
self.assertEqual(vals, {"rating__count": 6})
- vals = Book.objects.aggregate(Count("rating", distinct=True))
- self.assertEqual(vals, {"rating__count": 4})
-
def test_count_star(self):
with self.assertNumQueries(1) as ctx:
Book.objects.aggregate(n=Count("*"))
@@ -403,6 +400,10 @@ class AggregateTestCase(TestCase):
)
self.assertEqual(aggs['distinct_ratings'], 4)
+ def test_distinct_on_aggregate(self):
+ books = Book.objects.aggregate(ratings=Count('rating', distinct=True))
+ self.assertEqual(books['ratings'], 4)
+
def test_non_grouped_annotation_not_in_group_by(self):
"""
An annotation not included in values() before an aggregate should be