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

Function test_subquery_select

tests/test_queryset.py:771–778  ·  view source on GitHub ↗
(db)

Source from the content-addressed store, hash-verified

769
770@pytest.mark.asyncio
771async def test_subquery_select(db):
772 t1 = await Tournament.create(name="1")
773 ret = (
774 await Tournament.filter(pk=t1.pk)
775 .annotate(ids=Subquery(Tournament.filter(pk=t1.pk).values("id")))
776 .values("ids", "id")
777 )
778 assert ret == [{"id": t1.pk, "ids": t1.pk}]
779
780
781@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 5

SubqueryClass · 0.90
createMethod · 0.45
valuesMethod · 0.45
annotateMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…