From 1674c70525bc370132a1db27617e468081920d11 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Sat, 24 Sep 2022 00:15:03 +1000 Subject: Fixed #34024 -- Fixed crash when aggregating querysets with Q objects annotations. This reverts b64db05b9cedd96905d637a2d824cbbf428e40e7. It was reasonable to assume it was unnecessary code as there were no failing tests upon its removal. This commit adds the necessary regression tests for the failing condition identified in #34024 alongside the original tests added in the PR for which WhereNode.is_summary was introduced. --- tests/aggregation_regress/tests.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index e15e7e41d9..6d6902b61a 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -554,6 +554,9 @@ class AggregationTests(TestCase): 325, ) + def test_q_annotation_aggregate(self): + self.assertEqual(Book.objects.annotate(has_pk=Q(pk__isnull=False)).count(), 6) + def test_decimal_aggregate_annotation_filter(self): """ Filtering on an aggregate annotation with Decimal values should work. -- cgit v1.3