summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/expressions/tests.py7
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):