mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Thanks Mariusz Felisiak and Simon Charette for reviews.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e46ca51c24
commit
8b040e3cbb
@@ -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'), [
|
||||
|
||||
Reference in New Issue
Block a user