From 88fc9e2826044110b7b22577a227f122fe9c1fb5 Mon Sep 17 00:00:00 2001 From: Attila Tovt Date: Sun, 22 Nov 2015 02:59:37 +0200 Subject: Fixed #25772 -- Corrected __len lookup on ArrayField for empty arrays. --- tests/postgres_tests/test_array.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/postgres_tests/test_array.py') diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index f5047755a7..0ff7198fc2 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -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]), -- cgit v1.3