1
0
mirror of https://github.com/django/django.git synced 2025-10-29 00:26:07 +00:00

[1.9.x] Fixed #25772 -- Corrected __len lookup on ArrayField for empty arrays.

Backport of 88fc9e2826 from master
This commit is contained in:
Attila Tovt
2015-11-22 02:59:37 +02:00
committed by Tim Graham
parent 5456c85ba8
commit e4bd6923bd
3 changed files with 15 additions and 1 deletions

View File

@@ -231,6 +231,13 @@ class TestQuerying(PostgreSQLTestCase):
self.objs[0:3]
)
def test_len_empty_array(self):
obj = NullableIntegerArrayModel.objects.create(field=[])
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__len=0),
[obj]
)
def test_slice(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__0_1=[2]),