Changes between Initial Version and Version 1 of Ticket #34255, comment 9


Ignore:
Timestamp:
Jan 13, 2023, 7:09:01 AM (23 months ago)
Author:
Mariusz Felisiak

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34255, comment 9

    initial v1  
    33#!diff
    44diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
    5 index 54e1e6f13a..e166a2ae3c 100644
     5index 54e1e6f13a..bd3ea55647 100644
    66--- a/tests/aggregation/tests.py
    77+++ 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):
    917         ).annotate(total=Count("*"))
    1018         self.assertEqual(dict(has_long_books_breakdown), {True: 2, False: 3})
     
    1321+        books_qs = (
    1422+            Book.objects.annotate(
    15 +                greatest_rating=Greatest(
    16 +                    "rating", Value(4.5), output_field=DecimalField()
    17 +                )
     23+                greatest_pages=Greatest("pages", Value(600))
    1824+            )
    1925+            .values(
    20 +                "greatest_rating",
     26+                "greatest_pages",
    2127+            )
    2228+            .annotate(
    23 +                min_price=Max("price"),
    24 +                bigger=Greatest("min_price", "greatest_rating"),
     29+                min_pages=Min("pages"),
     30+                least=Least("min_pages", "greatest_pages"),
    2531+            )
    26 +            .values_list("bigger", flat=True)
     32+            .values_list("least", flat=True)
    2733+        )
    28 +        self.assertCountEqual(
    29 +            books_qs,
    30 +            [Decimal("82.8"), Decimal("75")],
    31 +        )
     34+        self.assertCountEqual(books_qs, [300, 946, 1132])
    3235+
    3336     @skipUnlessDBFeature("supports_subqueries_in_group_by")
Back to Top