summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorAttila Tovt <uran198@gmail.com>2015-11-22 02:59:37 +0200
committerTim Graham <timograham@gmail.com>2015-11-25 16:53:27 -0500
commit3ec4e739dd4ac3f1dea92cdec858bf491f63d5e8 (patch)
tree40a2114d70fad9750d2f9af1b75089c5dd9c190b /tests/postgres_tests
parent78627091f890061831f29085c5c5b47036be5cc6 (diff)
[1.8.x] Fixed #25772 -- Corrected __len lookup on ArrayField for empty arrays.
Backport of 88fc9e2826044110b7b22577a227f122fe9c1fb5 from master
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_array.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index fb7eb16da2..b514a4329e 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -218,6 +218,13 @@ class TestQuerying(TestCase):
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]),