summaryrefslogtreecommitdiff
path: root/tests/aggregation_regress
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-01-25 20:28:34 -0800
committerTim Graham <timograham@gmail.com>2018-01-26 09:35:50 -0500
commit3187c89d6f8c60ca7e78093d5b37e0709e71cea9 (patch)
treee32778e48e76abceb01e29536e86d52f6c2fe641 /tests/aggregation_regress
parentd0b44c44ef6ac8b6a7e332b83b9932f23dee41fd (diff)
downloaddjango-3187c89d6f8c60ca7e78093d5b37e0709e71cea9.tar.gz
Fixed #29067 -- Fixed regression in QuerySet.values_list(..., flat=True) followed by annotate().
Diffstat (limited to 'tests/aggregation_regress')
-rw-r--r--tests/aggregation_regress/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 91e993a6d1..9c8bac0d21 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -1475,6 +1475,11 @@ class AggregationTests(TestCase):
vals2 = Book.objects.aggregate(result=Sum('rating') - Value(4.0))
self.assertEqual(vals1, vals2)
+ def test_annotate_values_list_flat(self):
+ """Find ages that are shared by at least two authors."""
+ qs = Author.objects.values_list('age', flat=True).annotate(age_count=Count('age')).filter(age_count__gt=1)
+ self.assertSequenceEqual(qs, [29])
+
class JoinPromotionTests(TestCase):
def test_ticket_21150(self):