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

Function test_prefetch_o2o

tests/test_prefetching.py:66–73  ·  view source on GitHub ↗
(db)

Source from the content-addressed store, hash-verified

64
65@pytest.mark.asyncio
66async def test_prefetch_o2o(db):
67 tournament = await Tournament.create(name="tournament")
68 event = await Event.create(name="First", tournament=tournament)
69 await Address.create(city="Santa Monica", street="Ocean", event=event)
70
71 fetched_events = await Event.all().prefetch_related("address").first()
72
73 assert fetched_events.address.city == "Santa Monica"
74
75
76@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 4

createMethod · 0.45
firstMethod · 0.45
prefetch_relatedMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…