Debian Codegraph @

tests/benchmarks/test_repeated_fields.py

raw
1 from graphql import (
2 GraphQLField,
3 GraphQLObjectType,
4 GraphQLSchema,
5 GraphQLString,
6 graphql_sync,
7 )
8
9 schema = GraphQLSchema(
10 query=GraphQLObjectType(
11 name="Query",
12 fields={
13 "hello": GraphQLField(
14 GraphQLString,
15 resolve=lambda _obj, _info: "world",
16 )
17 },
18 )
19 )
20 source = f"{{ {'hello ' * 250}}}"
21
22
23 def test_many_repeated_fields(benchmark):
24 result = benchmark(lambda: graphql_sync(schema, source))
25 assert result == ({"hello": "world"}, None)