summaryrefslogtreecommitdiff
path: root/tests/aggregation/tests.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2023-11-17 20:40:31 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-11-18 15:40:52 +0100
commit15cb3c262a7df568bb5c0e3e07d5078c08ef59f4 (patch)
tree7b399a80e166ebd6298e4d776c804b77f12d08a4 /tests/aggregation/tests.py
parent7530cf3900ab98104edcde69e8a2a415e82b345a (diff)
Refs #34975 -- Complemented rhs filtering aggregations for __in lookup.
While this isn't a regression it's clear that similar logic should be applied when dealing with lists of expressions passed as a lookup value.
Diffstat (limited to 'tests/aggregation/tests.py')
-rw-r--r--tests/aggregation/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index af6c660cf1..b01df88109 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -2315,3 +2315,9 @@ class AggregateAnnotationPruningTests(TestCase):
max_book_author=Max("book__authors"),
).aggregate(count=Count("id", filter=Q(id=F("max_book_author"))))
self.assertEqual(aggregates, {"count": 1})
+
+ def test_aggregate_reference_lookup_rhs_iter(self):
+ aggregates = Author.objects.annotate(
+ max_book_author=Max("book__authors"),
+ ).aggregate(count=Count("id", filter=Q(id__in=[F("max_book_author"), 0])))
+ self.assertEqual(aggregates, {"count": 1})