summaryrefslogtreecommitdiff
path: root/tests/aggregation_regress/tests.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2026-02-09 20:57:37 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2026-03-21 15:14:48 +0100
commitf2169ef3688422d394d36007e320bac839117f0b (patch)
treece59a090921616bbb78061411d21ac6cc1fc97c3 /tests/aggregation_regress/tests.py
parentd9adcfbd5e3ba5859cc0ce6e2e67f533efbc8f9b (diff)
Refs #36883 -- Split monolithic aggregation/lookup/queries tests.
Diffstat (limited to 'tests/aggregation_regress/tests.py')
-rw-r--r--tests/aggregation_regress/tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 1140022b4c..33763d589b 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -636,10 +636,11 @@ class AggregationTests(TestCase):
Max("foo")
)
- def test_more(self):
+ def test_count_after_count_function(self):
# Old-style count aggregations can be mixed with new-style
self.assertEqual(Book.objects.annotate(num_authors=Count("authors")).count(), 6)
+ def test_aggregates_over_annotations(self):
# Non-ordinal, non-computed Aggregates over annotations correctly
# inherit the annotation's internal type if the annotation is ordinal
# or computed
@@ -653,10 +654,12 @@ class AggregationTests(TestCase):
)
self.assertEqual(vals, {"avg_price__max": 75.0})
+ def test_aliases_quoted(self):
# Aliases are quoted to protected aliases that might be reserved names
vals = Book.objects.aggregate(number=Max("pages"), select=Max("pages"))
self.assertEqual(vals, {"number": 1132, "select": 1132})
+ def test_select_related(self):
# Regression for #10064: select_related() plays nice with aggregates
obj = (
Book.objects.select_related("publisher")
@@ -680,6 +683,7 @@ class AggregationTests(TestCase):
},
)
+ def test_exclude_on_aggregate(self):
# Regression for #10010: exclude on an aggregate field is correctly
# negated
self.assertEqual(len(Book.objects.annotate(num_authors=Count("authors"))), 6)