MCPcopy Create free account
hub / github.com/Pometry/Raphtory / run_graphql_test

Function run_graphql_test

python/test_utils/utils.py:115–129  ·  view source on GitHub ↗
(query, expected_output, graph, sort_output=False)

Source from the content-addressed store, hash-verified

113
114
115def run_graphql_test(query, expected_output, graph, sort_output=False):
116 tmp_work_dir = tempfile.mkdtemp()
117 with GraphServer(tmp_work_dir).start() as server:
118 client = server.get_client()
119 client.send_graph(path="g", graph=graph)
120 response = client.query(query)
121
122 # Convert response to a dictionary if needed and compare
123 response_dict = json.loads(response) if isinstance(response, str) else response
124 if sort_output:
125 response_dict = sort_by_gql_name_or_id(response_dict)
126 expected_output = sort_by_gql_name_or_id(expected_output)
127 assert (
128 response_dict == expected_output
129 ), f"left={sort_dict_recursive(response_dict)}\nright={sort_dict_recursive(expected_output)}"
130
131
132def run_group_graphql_test(queries_and_expected_outputs, graph, sort_output=False):

Callers 15

test_apply_view_latestFunction · 0.90
test_apply_view_atFunction · 0.90
test_apply_view_windowFunction · 0.90
test_apply_view_beforeFunction · 0.90
test_apply_view_afterFunction · 0.90
test_apply_view_layersFunction · 0.90

Calls 7

GraphServerClass · 0.90
sort_by_gql_name_or_idFunction · 0.85
sort_dict_recursiveFunction · 0.85
get_clientMethod · 0.80
startMethod · 0.45
send_graphMethod · 0.45
queryMethod · 0.45

Tested by 15

test_apply_view_latestFunction · 0.72
test_apply_view_atFunction · 0.72
test_apply_view_windowFunction · 0.72
test_apply_view_beforeFunction · 0.72
test_apply_view_afterFunction · 0.72
test_apply_view_layersFunction · 0.72