Test array length filter.
(db_array_fields)
| 178 | @requireCapability(dialect="postgres") |
| 179 | @pytest.mark.asyncio |
| 180 | async def test_array_length(db_array_fields): |
| 181 | """Test array length filter.""" |
| 182 | await testmodels.ArrayFields.create(array=[1, 2, 3]) |
| 183 | await testmodels.ArrayFields.create(array=[1]) |
| 184 | await testmodels.ArrayFields.create(array=[1, 2]) |
| 185 | |
| 186 | found = await testmodels.ArrayFields.filter(array__len=3).values_list("array", flat=True) |
| 187 | assert list(found) == [[1, 2, 3]] |
| 188 | |
| 189 | found = await testmodels.ArrayFields.filter(array__len=1).values_list("array", flat=True) |
| 190 | assert list(found) == [[1]] |
| 191 | |
| 192 | found = await testmodels.ArrayFields.filter(array__len=0).values_list("array", flat=True) |
| 193 | assert list(found) == [] |
nothing calls this directly
no test coverage detected
searching dependent graphs…