summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2021-06-22 09:51:12 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-06-28 09:21:57 +0200
commite8e8e207e72835cac3e36e3e26a864c59d5b490f (patch)
tree4b2c0b2ab0864f0166ee6d53c1f37b69ecd3431e /tests
parent1aca9fc7d240973df00c8543faea17fbb1274ff9 (diff)
Ensured that empty result test for JSONBAgg executes a query.
Use of QuerySet.none() will cause the EmptyQuerySet aggregation optimisation to be used. Change the test to be implemented like the other tests for empty results in this file.
Diffstat (limited to 'tests')
-rw-r--r--tests/postgres_tests/test_aggregates.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py
index 688af585aa..d7656d8b50 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -278,8 +278,9 @@ class TestGeneralAggregate(PostgreSQLTestCase):
values = AggregateTestModel.objects.aggregate(jsonbagg=JSONBAgg('char_field'))
self.assertEqual(values, {'jsonbagg': ['Foo1', 'Foo2', 'Foo4', 'Foo3']})
- def test_jsonb_agg_empty(self):
- values = AggregateTestModel.objects.none().aggregate(jsonbagg=JSONBAgg('integer_field'))
+ def test_jsonb_agg_empty_result(self):
+ AggregateTestModel.objects.all().delete()
+ values = AggregateTestModel.objects.aggregate(jsonbagg=JSONBAgg('integer_field'))
self.assertEqual(values, json.loads('{"jsonbagg": []}'))
def test_jsonb_agg_charfield_ordering(self):