diff options
| author | Simon Charette <charette.s@gmail.com> | 2022-09-22 23:57:06 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-10-06 09:34:31 +0200 |
| commit | 04518e310d4552ff7595a34f5a7f93487d78a406 (patch) | |
| tree | 0cb94a0dfc2b8c63d3da0ceb90d41b048b067695 /tests/aggregation_regress | |
| parent | c58a8acd413ccc992dd30afd98ed900897e1f719 (diff) | |
Refs #33308 -- Enabled explicit GROUP BY and ORDER BY aliases.
This ensures explicit grouping from using values() before annotating an
aggregate function groups by selected aliases if supported.
The GROUP BY feature is disabled on Oracle because it doesn't support it.
Diffstat (limited to 'tests/aggregation_regress')
| -rw-r--r-- | tests/aggregation_regress/tests.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 6d6902b61a..1fe86aad3e 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -178,10 +178,19 @@ class AggregationTests(TestCase): ) .annotate(sum_discount=Sum("discount_price")) ) - self.assertSequenceEqual( - values, - [{"discount_price": Decimal("59.38"), "sum_discount": Decimal("59.38")}], - ) + with self.assertNumQueries(1) as ctx: + self.assertSequenceEqual( + values, + [ + { + "discount_price": Decimal("59.38"), + "sum_discount": Decimal("59.38"), + } + ], + ) + if connection.features.allows_group_by_refs: + alias = connection.ops.quote_name("discount_price") + self.assertIn(f"GROUP BY {alias}", ctx[0]["sql"]) def test_aggregates_in_where_clause(self): """ |
