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.py8
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'), [