Skip to content

Commit 57396e2

Browse files
committed
Fix benchmark test.
1 parent ee3e8aa commit 57396e2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tests/benchmarks/test_relationship_loading.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Query:
5959
@strawberry.field
6060
@staticmethod
6161
async def parents(info: Info) -> List[StrawberryParent]:
62-
return info.context["session"].execute(sa.select(Parent)).all()
62+
return info.context["session"].query(Parent).all()
6363

6464
mapper.finalize()
6565
base.metadata.create_all(engine)
@@ -90,15 +90,15 @@ async def execute():
9090
# Notice how we use a sync session but call Strawberry's async execute.
9191
# This is not an ideal combination, but it's certainly a common one that
9292
# we need to support efficiently.
93-
await schema.execute(
93+
result = await schema.execute(
9494
"""
9595
query {
9696
parents {
97-
a { edges { node { id } } },
98-
b { edges { node { id } } },
99-
c { edges { node { id } } },
100-
d { edges { node { id } } },
101-
e { edges { node { id } } },
97+
a { id },
98+
b { id },
99+
c { id },
100+
d { id },
101+
e { id },
102102
}
103103
}
104104
""",
@@ -109,5 +109,7 @@ async def execute():
109109
),
110110
},
111111
)
112+
assert not result.errors
113+
assert len(result.data["parents"]) == 10
112114

113115
benchmark(async_to_sync(execute))

0 commit comments

Comments
 (0)