Unverified Kaydet (Commit) 654614b3 authored tarafından Mariusz Felisiak's avatar Mariusz Felisiak Kaydeden (comit) GitHub

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

Fixed in 3af695ed.
üst 03db5fdd
...@@ -149,6 +149,14 @@ class TestQuerying(PostgreSQLTestCase): ...@@ -149,6 +149,14 @@ class TestQuerying(PostgreSQLTestCase):
NullableIntegerArrayModel(field=None), 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): def test_exact(self):
self.assertSequenceEqual( self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__exact=[1]), NullableIntegerArrayModel.objects.filter(field__exact=[1]),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment