summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-04-18 12:06:39 +0200
committerGitHub <noreply@github.com>2019-04-18 12:06:39 +0200
commit654614b38e09de47e542c5b5d52c194e1d146a39 (patch)
treeb10bf133d8aa02fa0de2b6d9349fc7fbdc20c0c3 /tests/postgres_tests/test_array.py
parent03db5fddfd0c76303ec83eb1cd91a6d2dc4441cb (diff)
downloaddjango-654614b38e09de47e542c5b5d52c194e1d146a39.tar.gz
Refs #28767 -- Added test for annotating Value() with empty list as an ArrayField.
Fixed in 3af695eda24b874486ee8be7e0d729761b3bdc71.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index 465eac1785..5ee5b377da 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -149,6 +149,14 @@ class TestQuerying(PostgreSQLTestCase):
NullableIntegerArrayModel(field=None),
])
+ def test_empty_list(self):
+ NullableIntegerArrayModel.objects.create(field=[])
+ obj = NullableIntegerArrayModel.objects.annotate(
+ empty_array=models.Value([], output_field=ArrayField(models.IntegerField())),
+ ).filter(field=models.F('empty_array')).get()
+ self.assertEqual(obj.field, [])
+ self.assertEqual(obj.empty_array, [])
+
def test_exact(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__exact=[1]),