diff options
| author | orf <tom@tomforb.es> | 2017-01-23 15:34:42 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-04 13:57:39 -0500 |
| commit | b5393028bfc939adf14d0fa5e4088cddd3b9dfa1 (patch) | |
| tree | 4168b42b77be5bce7d3b8d0acf2819098344412c /tests/postgres_tests/test_aggregates.py | |
| parent | 245f20910906c8f17e1011a00f7042e1d8f39c76 (diff) | |
Fixed #27767 -- Added distinct argument to ArrayAgg.
Diffstat (limited to 'tests/postgres_tests/test_aggregates.py')
| -rw-r--r-- | tests/postgres_tests/test_aggregates.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py index 9aa0e06595..056d08441b 100644 --- a/tests/postgres_tests/test_aggregates.py +++ b/tests/postgres_tests/test_aggregates.py @@ -128,7 +128,7 @@ class TestGeneralAggregate(PostgreSQLTestCase): self.assertEqual(values, json.loads('{"jsonagg": []}')) -class TestStringAggregateDistinct(PostgreSQLTestCase): +class TestAggregateDistinct(PostgreSQLTestCase): @classmethod def setUpTestData(cls): AggregateTestModel.objects.create(char_field='Foo') @@ -145,6 +145,14 @@ class TestStringAggregateDistinct(PostgreSQLTestCase): self.assertEqual(values['stringagg'].count('Foo'), 1) self.assertEqual(values['stringagg'].count('Bar'), 1) + def test_array_agg_distinct_false(self): + values = AggregateTestModel.objects.aggregate(arrayagg=ArrayAgg('char_field', distinct=False)) + self.assertEqual(sorted(values['arrayagg']), ['Bar', 'Foo', 'Foo']) + + def test_array_agg_distinct_true(self): + values = AggregateTestModel.objects.aggregate(arrayagg=ArrayAgg('char_field', distinct=True)) + self.assertEqual(sorted(values['arrayagg']), ['Bar', 'Foo']) + class TestStatisticsAggregate(PostgreSQLTestCase): @classmethod |
