MCPcopy
hub / github.com/tortoise/tortoise-orm / test__remove__many

Function test__remove__many

tests/fields/test_m2m.py:79–90  ·  view source on GitHub ↗

Test removing multiple related objects at once.

(db)

Source from the content-addressed store, hash-verified

77
78@pytest.mark.asyncio
79async def test__remove__many(db):
80 """Test removing multiple related objects at once."""
81 one = await testmodels.M2MOne.create(name="One")
82 two1 = await testmodels.M2MTwo.create(name="Two1")
83 two2 = await testmodels.M2MTwo.create(name="Two2")
84 two3 = await testmodels.M2MTwo.create(name="Two3")
85 await one.two.add(two1, two2, two3)
86 await one.two.remove(two1, two2)
87 assert await one.two == [two3]
88 assert await two1.one == []
89 assert await two2.one == []
90 assert await two3.one == [one]
91
92
93@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

addMethod · 0.80
removeMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…