From 8b040e3cbbb2e81420e777afc3ca48a1c8f4dd5a Mon Sep 17 00:00:00 2001 From: Ian Foote Date: Sun, 15 Nov 2020 22:43:47 +0000 Subject: Fixed #25534, Fixed #31639 -- Added support for transform references in expressions. Thanks Mariusz Felisiak and Simon Charette for reviews. --- tests/aggregation/tests.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/aggregation') diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index 43fd9dd074..ad4b94a7f9 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -151,6 +151,14 @@ class AggregateTestCase(TestCase): vals = Store.objects.filter(name="Amazon.com").aggregate(amazon_mean=Avg("books__rating")) self.assertEqual(vals, {'amazon_mean': Approximate(4.08, places=2)}) + def test_aggregate_transform(self): + vals = Store.objects.aggregate(min_month=Min('original_opening__month')) + self.assertEqual(vals, {'min_month': 3}) + + def test_aggregate_join_transform(self): + vals = Publisher.objects.aggregate(min_year=Min('book__pubdate__year')) + self.assertEqual(vals, {'min_year': 1991}) + def test_annotate_basic(self): self.assertQuerysetEqual( Book.objects.annotate().order_by('pk'), [ -- cgit v1.3