diff options
author | Ian Foote <python@ian.feete.org> | 2020-11-15 22:43:47 +0000 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-11-27 20:42:04 +0100 |
commit | 8b040e3cbbb2e81420e777afc3ca48a1c8f4dd5a (patch) | |
tree | 32ed8b5456c9ce569643a1ebb34491a1c9b6fa01 /tests/aggregation | |
parent | e46ca51c249677c52e04db28fc0c60ae1948b3b2 (diff) | |
download | django-8b040e3cbbb2e81420e777afc3ca48a1c8f4dd5a.tar.gz |
Fixed #25534, Fixed #31639 -- Added support for transform references in expressions.
Thanks Mariusz Felisiak and Simon Charette for reviews.
Diffstat (limited to 'tests/aggregation')
-rw-r--r-- | tests/aggregation/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
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'), [ |