summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
authorIon Alberdi <ion.alberdi@pricemoov.com>2022-10-09 11:01:14 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-11-03 06:59:49 +0100
commit3dc9f3ac6960c83cd32058677eb0ddb5a5e5da43 (patch)
tree497cad64b6608b1d3f527cdc6f068cb63c0e1eba /tests/postgres_tests/test_array.py
parent34d63d5a41188a32b77733e33c1fad64f37c6772 (diff)
downloaddjango-3dc9f3ac6960c83cd32058677eb0ddb5a5e5da43.tar.gz
Fixed #34080 -- Fixed __exact lookup when nested arrays contain only NULL values.
Thanks jerch and David Sanders for reviews.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index fc4687b68c..89603e24a0 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -253,6 +253,24 @@ class TestQuerying(PostgreSQLTestCase):
[obj],
)
+ def test_exact_null_only_nested_array(self):
+ obj1 = NullableIntegerArrayModel.objects.create(field_nested=[[None, None]])
+ obj2 = NullableIntegerArrayModel.objects.create(
+ field_nested=[[None, None], [None, None]],
+ )
+ self.assertSequenceEqual(
+ NullableIntegerArrayModel.objects.filter(
+ field_nested__exact=[[None, None]],
+ ),
+ [obj1],
+ )
+ self.assertSequenceEqual(
+ NullableIntegerArrayModel.objects.filter(
+ field_nested__exact=[[None, None], [None, None]],
+ ),
+ [obj2],
+ )
+
def test_exact_with_expression(self):
self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__exact=[Value(1)]),