Refs #34080 -- Added tests for __exact lookup when non-nested arrays contain only NULL values.

This commit is contained in:
Ion Alberdi 2022-11-03 06:29:30 +01:00 committed by Mariusz Felisiak
parent 71e9694856
commit 34d63d5a41
1 changed files with 12 additions and 0 deletions

View File

@ -241,6 +241,18 @@ class TestQuerying(PostgreSQLTestCase):
NullableIntegerArrayModel.objects.filter(field__exact=[1]), self.objs[:1] 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): def test_exact_with_expression(self):
self.assertSequenceEqual( self.assertSequenceEqual(
NullableIntegerArrayModel.objects.filter(field__exact=[Value(1)]), NullableIntegerArrayModel.objects.filter(field__exact=[Value(1)]),