summaryrefslogtreecommitdiff
path: root/tests/aggregation/tests.py
diff options
context:
space:
mode:
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 a073d01590..af6c660cf1 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -2309,3 +2309,9 @@ class AggregateAnnotationPruningTests(TestCase):
aggregate,
{"sum_avg_publisher_pages": 1100.0, "books_count": 2},
)
+
+ def test_aggregate_reference_lookup_rhs(self):
+ aggregates = Author.objects.annotate(
+ max_book_author=Max("book__authors"),
+ ).aggregate(count=Count("id", filter=Q(id=F("max_book_author"))))
+ self.assertEqual(aggregates, {"count": 1})