Skip to content

Commit ccc1c83

Browse files
committed
modify test to allow to modify static_result easily for some manual tests
1 parent d2ff81f commit ccc1c83

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

tests/custom_scalars/test_parse_results.py

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@
1111

1212
from gql import Client, gql
1313

14+
static_result = {
15+
"edges": [
16+
{
17+
"node": {
18+
"from": {"address": "0x45b9ad45995577fe"},
19+
"to": {"address": "0x6394e988297f5ed2"},
20+
}
21+
},
22+
{"node": {"from": None, "to": {"address": "0x6394e988297f5ed2"}}},
23+
]
24+
}
1425

15-
def static_result(root, _info, count):
16-
return {
17-
"edges": [
18-
{
19-
"node": {
20-
"from": {"address": "0x45b9ad45995577fe"},
21-
"to": {"address": "0x6394e988297f5ed2"},
22-
}
23-
},
24-
{"node": {"from": None, "to": {"address": "0x6394e988297f5ed2"}}},
25-
]
26-
}
26+
27+
def resolve_test(root, _info, count):
28+
return static_result
2729

2830

2931
Account = GraphQLObjectType(
@@ -60,7 +62,7 @@ def static_result(root, _info, count):
6062
},
6163
),
6264
args={"count": GraphQLArgument(GraphQLInt)},
63-
resolve=static_result,
65+
resolve=resolve_test,
6466
),
6567
},
6668
)
@@ -92,15 +94,5 @@ def test_parse_results_null_mapping():
9294
)
9395

9496
assert client.execute(query, variable_values={"count": 2}) == {
95-
"test": {
96-
"edges": [
97-
{
98-
"node": {
99-
"from": {"address": "0x45b9ad45995577fe"},
100-
"to": {"address": "0x6394e988297f5ed2"},
101-
}
102-
},
103-
{"node": {"from": None, "to": {"address": "0x6394e988297f5ed2"}}},
104-
]
105-
}
97+
"test": static_result
10698
}

0 commit comments

Comments
 (0)