diff options
author | Tomer Chachamu <tomer.chachamu@gmail.com> | 2019-04-18 12:11:21 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-18 12:54:19 +0200 |
commit | ceab25bc6d0d095acfcea46c35d93c17d008fd35 (patch) | |
tree | 84db5d4c92a1227edf96446fc4794dc88169a7ca /tests/postgres_tests/test_array.py | |
parent | 654614b38e09de47e542c5b5d52c194e1d146a39 (diff) | |
download | django-ceab25bc6d0d095acfcea46c35d93c17d008fd35.tar.gz |
Refs #28762 -- Added test for aggregating over a function with ArrayField parameters.
Fixed in d87bd29c4f8dfcdf3f4a4eb8340e6770a2416fe3.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r-- | tests/postgres_tests/test_array.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 5ee5b377da..d7ed5223e3 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -385,6 +385,17 @@ class TestQuerying(PostgreSQLTestCase): with self.assertRaisesMessage(FieldError, msg): list(NullableIntegerArrayModel.objects.filter(field__0bar=[2])) + def test_grouping_by_annotations_with_array_field_param(self): + value = models.Value([1], output_field=ArrayField(models.IntegerField())) + self.assertEqual( + NullableIntegerArrayModel.objects.annotate( + array_length=models.Func(value, 1, function='ARRAY_LENGTH'), + ).values('array_length').annotate( + count=models.Count('pk'), + ).get()['array_length'], + 1, + ) + class TestDateTimeExactQuerying(PostgreSQLTestCase): |