summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
authorIon Alberdi <ion.alberdi@pricemoov.com>2022-11-03 06:29:30 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-11-03 06:39:34 +0100
commit34d63d5a41188a32b77733e33c1fad64f37c6772 (patch)
tree98567a63ab4cc54db2808ff1adcb57a427021967 /tests/postgres_tests/test_array.py
parent71e9694856627d4027c9df066045f0e1c2b5cf27 (diff)
downloaddjango-34d63d5a41188a32b77733e33c1fad64f37c6772.tar.gz
Refs #34080 -- Added tests for __exact lookup when non-nested arrays contain only NULL values.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index c23ed9fe0c..fc4687b68c 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -241,6 +241,18 @@ class TestQuerying(PostgreSQLTestCase):
NullableIntegerArrayModel.objects.filter(field__exact=[1]), self.objs[:1]
)
+ def test_exact_null_only_array(self):
+ obj = NullableIntegerArrayModel.objects.create(
+ field=[None], field_nested=[None, None]
+ )
+ self.assertSequenceEqual(
+ NullableIntegerArrayModel.objects.filter(field__exact=[None]), [obj]
+ )
+ self.assertSequenceEqual(
+ NullableIntegerArrayModel.objects.filter(field_nested__exact=[None, None]),
+ [obj],
+ )
+
def test_exact_with_expression(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__exact=[Value(1)]),