summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/aggregation/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index 8d8e46e312..a073d01590 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -2126,6 +2126,15 @@ class AggregateTestCase(TestCase):
qs = Publisher.objects.filter(pk__in=author_qs)
self.assertCountEqual(qs, [self.p1, self.p2, self.p3, self.p4])
+ def test_having_with_no_group_by(self):
+ author_qs = (
+ Author.objects.values(static_value=Value("static-value"))
+ .annotate(sum=Sum("age"))
+ .filter(sum__gte=0)
+ .values_list("sum", flat=True)
+ )
+ self.assertEqual(list(author_qs), [337])
+
class AggregateAnnotationPruningTests(TestCase):
@classmethod