From cb3c2da12858004c805fc511a9c2eb0f91fb73c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81tienne=20Beaule=CC=81?= Date: Mon, 29 Jul 2019 16:36:14 -0300 Subject: [PATCH] Moved test for distinct Count() to a separate test case. --- tests/aggregation/tests.py | 7 ++++--- 1 file 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