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

Function test_bulk_update

tests/test_update.py:45–52  ·  view source on GitHub ↗
(db)

Source from the content-addressed store, hash-verified

43
44@pytest.mark.asyncio
45async def test_bulk_update(db):
46 objs = [await Tournament.create(name="1"), await Tournament.create(name="2")]
47 objs[0].name = "0"
48 objs[1].name = "1"
49 rows_affected = await Tournament.bulk_update(objs, fields=["name"], batch_size=100)
50 assert rows_affected == 2
51 assert (await Tournament.get(pk=objs[0].pk)).name == "0"
52 assert (await Tournament.get(pk=objs[1].pk)).name == "1"
53
54
55@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

createMethod · 0.45
bulk_updateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…