1
0
mirror of https://github.com/django/django.git synced 2025-04-01 12:06:43 +00:00

Refs #28767 -- Added test for annotating Value() with empty list as an ArrayField.

Fixed in 3af695eda24b874486ee8be7e0d729761b3bdc71.
This commit is contained in:
Mariusz Felisiak 2019-04-18 12:06:39 +02:00 committed by GitHub
parent 03db5fddfd
commit 654614b38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]),