Changes between Initial Version and Version 1 of Ticket #34255, comment 9
- Timestamp:
- Jan 13, 2023, 7:09:01 AM (23 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34255, comment 9
initial v1 3 3 #!diff 4 4 diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py 5 index 54e1e6f13a.. e166a2ae3c1006445 index 54e1e6f13a..bd3ea55647 100644 6 6 --- a/tests/aggregation/tests.py 7 7 +++ b/tests/aggregation/tests.py 8 @@ -1614,6 +1614,27 @@ class AggregateTestCase(TestCase): 8 @@ -34,6 +34,7 @@ from django.db.models.functions import ( 9 Cast, 10 Coalesce, 11 Greatest, 12 + Least, 13 Lower, 14 Now, 15 Pi, 16 @@ -1614,6 +1615,22 @@ class AggregateTestCase(TestCase): 9 17 ).annotate(total=Count("*")) 10 18 self.assertEqual(dict(has_long_books_breakdown), {True: 2, False: 3}) … … 13 21 + books_qs = ( 14 22 + Book.objects.annotate( 15 + greatest_rating=Greatest( 16 + "rating", Value(4.5), output_field=DecimalField() 17 + ) 23 + greatest_pages=Greatest("pages", Value(600)) 18 24 + ) 19 25 + .values( 20 + "greatest_ rating",26 + "greatest_pages", 21 27 + ) 22 28 + .annotate( 23 + min_p rice=Max("price"),24 + bigger=Greatest("min_price", "greatest_rating"),29 + min_pages=Min("pages"), 30 + least=Least("min_pages", "greatest_pages"), 25 31 + ) 26 + .values_list(" bigger", flat=True)32 + .values_list("least", flat=True) 27 33 + ) 28 + self.assertCountEqual( 29 + books_qs, 30 + [Decimal("82.8"), Decimal("75")], 31 + ) 34 + self.assertCountEqual(books_qs, [300, 946, 1132]) 32 35 + 33 36 @skipUnlessDBFeature("supports_subqueries_in_group_by")