diff options
| author | Simon Charette <charette.s@gmail.com> | 2019-03-08 18:15:44 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-03-23 10:11:41 -0400 |
| commit | 3f32154f40a855afa063095e3d091ce6be21f2c5 (patch) | |
| tree | 0aa77087d8b65140760d7a251d5f65c35c95e74a /tests | |
| parent | d1e9c25162eecb24dee50fcfe834a2735e53fb0e (diff) | |
Refs #30188 -- Avoided GROUP BY when aggregating over non-aggregates.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/expressions/tests.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index a51080ef13..c19178b3ca 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -551,7 +551,6 @@ class BasicExpressionsTests(TestCase): ) self.assertEqual(qs.get().float, 1.2) - @skipUnlessDBFeature('supports_subqueries_in_group_by') def test_aggregate_subquery_annotation(self): with self.assertNumQueries(1) as ctx: aggregate = Company.objects.annotate( @@ -566,7 +565,11 @@ class BasicExpressionsTests(TestCase): self.assertEqual(aggregate, {'ceo_salary_gt_20': 1}) # Aggregation over a subquery annotation doesn't annotate the subquery # twice in the inner query. - self.assertLessEqual(ctx.captured_queries[0]['sql'].count('SELECT'), 4,) + sql = ctx.captured_queries[0]['sql'] + self.assertLessEqual(sql.count('SELECT'), 3) + # GROUP BY isn't required to aggregate over a query that doesn't + # contain nested aggregates. + self.assertNotIn('GROUP BY', sql) def test_explicit_output_field(self): class FuncA(Func): |
