MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / test__remove

Function test__remove

tests/fields/test_m2m.py:66–75  ·  view source on GitHub ↗

Test removing one related object from M2M relation.

(db)

Source from the content-addressed store, hash-verified

64
65@pytest.mark.asyncio
66async def test__remove(db):
67 """Test removing one related object from M2M relation."""
68 one = await testmodels.M2MOne.create(name="One")
69 two1 = await testmodels.M2MTwo.create(name="Two")
70 two2 = await testmodels.M2MTwo.create(name="Two")
71 await one.two.add(two1, two2)
72 await one.two.remove(two1)
73 assert await one.two == [two2]
74 assert await two1.one == []
75 assert await two2.one == [one]
76
77
78@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…