From 18c8ced81e4a6e093c732f8cded3b16426d16952 Mon Sep 17 00:00:00 2001 From: Artur Beltsov Date: Wed, 4 Nov 2020 16:30:47 +0500 Subject: Fixed #32169 -- Added distinct support to JSONBAgg. --- tests/postgres_tests/test_aggregates.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/postgres_tests') diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py index 06cca6313d..064536a2c6 100644 --- a/tests/postgres_tests/test_aggregates.py +++ b/tests/postgres_tests/test_aggregates.py @@ -428,6 +428,18 @@ class TestAggregateDistinct(PostgreSQLTestCase): values = AggregateTestModel.objects.aggregate(arrayagg=ArrayAgg('char_field', distinct=True)) self.assertEqual(sorted(values['arrayagg']), ['Bar', 'Foo']) + def test_json_agg_distinct_false(self): + values = AggregateTestModel.objects.aggregate( + jsonagg=JSONBAgg('char_field', distinct=False), + ) + self.assertEqual(sorted(values['jsonagg']), ['Bar', 'Foo', 'Foo']) + + def test_json_agg_distinct_true(self): + values = AggregateTestModel.objects.aggregate( + jsonagg=JSONBAgg('char_field', distinct=True), + ) + self.assertEqual(sorted(values['jsonagg']), ['Bar', 'Foo']) + class TestStatisticsAggregate(PostgreSQLTestCase): @classmethod -- cgit v1.3