summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Sanders <shang.xiao.sanders@gmail.com>2022-09-24 00:15:03 +1000
committerGitHub <noreply@github.com>2022-09-23 15:15:03 +0100
commit1674c70525bc370132a1db27617e468081920d11 (patch)
tree9536f8ecea5faf9747e13380c793174e3e519b1a /tests
parent37a13cc92d51d5a57b42240b9a5dd250648efa24 (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/aggregation_regress/tests.py3
1 files changed, 3 insertions, 0 deletions
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.