8000 Add sync batching to requests sync transport by itolosa · Pull Request #431 · graphql-python/gql · GitHub
[go: up one dir, main page]

Skip to content

Add sync batching to requests sync transport #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test batch with two queries instead of one
  • Loading branch information
itolosa committed Sep 5, 2023
commit 9f2e0af3db1d877d2d90e65a081f813eb2b7896d
9 changes: 6 additions & 3 deletions tests/custom_scalars/test_money.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from graphql.utilities import value_from_ast_untyped

from gql import Client, gql
from gql.transport.data_structures.graphql_request import GraphQLRequest
from gql.graphql_request import GraphQLRequest
from gql.transport.exceptions import TransportQueryError
from gql.utilities import serialize_value, update_schema_scalar, update_schema_scalars

Expand Down Expand Up @@ -763,7 +763,6 @@ def test_code():
async def test_custom_scalar_serialize_variables_sync_transport_2(
event_loop, aiohttp_server, run_sync_test
):

server, transport = await make_sync_money_transport(aiohttp_server)

def test_code():
Expand All @@ -774,12 +773,16 @@ def test_code():
variable_values = {"money": Money(10, "DM")}

results = session.execute_batch(
[GraphQLRequest(document=query, variable_values=variable_values)],
[
GraphQLRequest(document=query, variable_values=variable_values),
GraphQLRequest(document=query, variable_values=variable_values),
],
serialize_variables=True,
)

print(f"result = {results!r}")
assert results[0]["toEuros"] == 5
assert results[1]["toEuros"] == 5

await run_sync_test(event_loop, server, test_code)

Expand Down
0