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

Function test__add__two

tests/fields/test_m2m.py:54–62  ·  view source on GitHub ↗

Test adding multiple related objects at once.

(db)

Source from the content-addressed store, hash-verified

52
53@pytest.mark.asyncio
54async def test__add__two(db):
55 """Test adding multiple related objects at once."""
56 one = await testmodels.M2MOne.create(name="One")
57 two1 = await testmodels.M2MTwo.create(name="Two")
58 two2 = await testmodels.M2MTwo.create(name="Two")
59 await one.two.add(two1, two2)
60 assert await one.two == [two1, two2]
61 assert await two1.one == [one]
62 assert await two2.one == [one]
63
64
65@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

addMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…