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

Function test_contains_ints

tests/fields/test_array.py:85–95  ·  view source on GitHub ↗

Test contains filter on integer array field.

(db_array_fields)

Source from the content-addressed store, hash-verified

83@requireCapability(dialect="postgres")
84@pytest.mark.asyncio
85async def test_contains_ints(db_array_fields):
86 """Test contains filter on integer array field."""
87 obj1 = await testmodels.ArrayFields.create(array=[1, 2, 3])
88 obj2 = await testmodels.ArrayFields.create(array=[2, 3])
89 await testmodels.ArrayFields.create(array=[4, 5, 6])
90
91 found = await testmodels.ArrayFields.filter(array__contains=[2])
92 assert found == [obj1, obj2]
93
94 found = await testmodels.ArrayFields.filter(array__contains=[10])
95 assert found == []
96
97
98@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…