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

Function test_m2m_remove

tests/test_relations.py:175–183  ·  view source on GitHub ↗
(db)

Source from the content-addressed store, hash-verified

173
174@pytest.mark.asyncio
175async def test_m2m_remove(db):
176 tournament = await Tournament.create(name="tournament")
177 event = await Event.create(name="First", tournament=tournament)
178 team = await Team.create(name="1")
179 team_second = await Team.create(name="2")
180 await event.participants.add(team, team_second)
181 await event.participants.remove(team)
182 fetched_event = await Event.first().prefetch_related("participants")
183 assert len(fetched_event.participants) == 1
184
185
186@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 5

addMethod · 0.80
removeMethod · 0.80
createMethod · 0.45
prefetch_relatedMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…