-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
36 lines (31 loc) · 875 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gqljit
import graphql as g
def breakit(*args):
raise BaseException("yo!")
schema = g.GraphQLSchema(
query=g.GraphQLObjectType(
name="Query",
fields={
"viewer": g.GraphQLField(
g.GraphQLObjectType(
name="Viewer",
fields={
"Hello": g.GraphQLField(
g.GraphQLString,
# resolve=lambda root, info: root["Hello"].upper(),
resolve=breakit,
),
},
),
),
},
),
)
print(
g.graphql_sync(
schema,
"query { viewer { Hello } viewer2: viewer { Hello } }",
execution_context_class=gqljit.JITExecutionContext,
root_value={"viewer": {"Hello": "world!"}},
)
)