summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Beaulé <beauleetienne0@gmail.com>2019-07-29 16:36:14 -0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-07-31 10:41:17 +0200
commitcb3c2da12858004c805fc511a9c2eb0f91fb73c7 (patch)
treeb68bc66c4fe0b47b8ac29bd3c9ae9f6d567234c5
parentf618e033acd37d59b536d6e6126e6c5be18037f6 (diff)
Moved test for distinct Count() to a separate test case.
-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