MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / test_overlap_ints

Function test_overlap_ints

tests/fields/test_array.py:162–175  ·  view source on GitHub ↗

Test overlap filter on integer array field.

(db_array_fields)

Source from the content-addressed store, hash-verified

160@requireCapability(dialect="postgres")
161@pytest.mark.asyncio
162async def test_overlap_ints(db_array_fields):
163 """Test overlap filter on integer array field."""
164 obj1 = await testmodels.ArrayFields.create(array=[1, 2, 3])
165 obj2 = await testmodels.ArrayFields.create(array=[2, 3, 4])
166 obj3 = await testmodels.ArrayFields.create(array=[3, 4, 5])
167
168 found = await testmodels.ArrayFields.filter(array__overlap=[1, 2])
169 assert found == [obj1, obj2]
170
171 found = await testmodels.ArrayFields.filter(array__overlap=[4])
172 assert found == [obj2, obj3]
173
174 found = await testmodels.ArrayFields.filter(array__overlap=[1, 2, 3, 4, 5])
175 assert found == [obj1, obj2, obj3]
176
177
178@requireCapability(dialect="postgres")

Callers

nothing calls this directly

Calls 2

createMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…