11import pytest
2- from pandas import DataFrame
32
43from .conftest import CollectingQueryRunner
54from graphdatascience .graph_data_science import GraphDataScience
@@ -11,7 +10,7 @@ def test_all(runner: CollectingQueryRunner, gds: GraphDataScience) -> None:
1110 G , _ = gds .graph .cypher .project ("g" )
1211
1312 assert G .name () == "g"
14- assert runner .last_params () == dict ( graph_name = "g" )
13+ assert runner .last_params () == { " graph_name" : "g" }
1514
1615 assert (
1716 runner .last_query ()
@@ -25,7 +24,7 @@ def test_disconnected(runner: CollectingQueryRunner, gds: GraphDataScience) -> N
2524 G , _ = gds .graph .cypher .project ("g" , allow_disconnected_nodes = True )
2625
2726 assert G .name () == "g"
28- assert runner .last_params () == dict ( graph_name = "g" )
27+ assert runner .last_params () == { " graph_name" : "g" }
2928
3029 assert (
3130 runner .last_query ()
@@ -40,7 +39,7 @@ def test_inverse_graph(runner: CollectingQueryRunner, gds: GraphDataScience) ->
4039 G , _ = gds .graph .cypher .project ("g" , inverse = True ) # TODO: or using orientation="INVERSE"?
4140
4241 assert G .name () == "g"
43- assert runner .last_params () == dict ( graph_name = "g" )
42+ assert runner .last_params () == { " graph_name" : "g" }
4443
4544 assert (
4645 runner .last_query ()
@@ -54,9 +53,10 @@ def test_single_node_label(runner: CollectingQueryRunner, gds: GraphDataScience)
5453 G , _ = gds .graph .cypher .project ("g" , nodes = "A" )
5554
5655 assert G .name () == "g"
57- assert runner .last_params () == dict (
58- graph_name = "g" , data_config = {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ]}
59- )
56+ assert runner .last_params () == {
57+ "graph_name" : "g" ,
58+ "data_config" : {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ]},
59+ }
6060
6161 assert (
6262 runner .last_query ()
@@ -70,9 +70,10 @@ def test_disconnected_nodes_single_node_label(runner: CollectingQueryRunner, gds
7070 G , _ = gds .graph .cypher .project ("g" , nodes = "A" , allow_disconnected_nodes = True )
7171
7272 assert G .name () == "g"
73- assert runner .last_params () == dict (
74- graph_name = "g" , data_config = {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ]}
75- )
73+ assert runner .last_params () == {
74+ "graph_name" : "g" ,
75+ "data_config" : {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ]},
76+ }
7677
7778 assert (
7879 runner .last_query ()
@@ -84,12 +85,13 @@ def test_disconnected_nodes_single_node_label(runner: CollectingQueryRunner, gds
8485
8586@pytest .mark .parametrize ("server_version" , [ServerVersion (2 , 4 , 0 )])
8687def test_single_node_label_alias (runner : CollectingQueryRunner , gds : GraphDataScience ) -> None :
87- G , _ = gds .graph .cypher .project ("g" , nodes = dict ( Target = " Label") )
88+ G , _ = gds .graph .cypher .project ("g" , nodes = { " Target" : " Label"} )
8889
8990 assert G .name () == "g"
90- assert runner .last_params () == dict (
91- graph_name = "g" , data_config = {"sourceNodeLabels" : ["Target" ], "targetNodeLabels" : ["Target" ]}
92- )
91+ assert runner .last_params () == {
92+ "graph_name" : "g" ,
93+ "data_config" : {"sourceNodeLabels" : ["Target" ], "targetNodeLabels" : ["Target" ]},
94+ }
9395
9496 assert (
9597 runner .last_query ()
@@ -103,9 +105,10 @@ def test_multiple_node_labels_and(runner: CollectingQueryRunner, gds: GraphDataS
103105 G , _ = gds .graph .cypher .project ("g" , nodes = ["A" , "B" ], combine_labels_with = "AND" )
104106
105107 assert G .name () == "g"
106- assert runner .last_params () == dict (
107- graph_name = "g" , data_config = {"sourceNodeLabels" : ["A" , "B" ], "targetNodeLabels" : ["A" , "B" ]}
108- )
108+ assert runner .last_params () == {
109+ "graph_name" : "g" ,
110+ "data_config" : {"sourceNodeLabels" : ["A" , "B" ], "targetNodeLabels" : ["A" , "B" ]},
111+ }
109112
110113 assert (
111114 runner .last_query ()
@@ -119,9 +122,10 @@ def test_disconnected_nodes_multiple_node_labels_and(runner: CollectingQueryRunn
119122 G , _ = gds .graph .cypher .project ("g" , nodes = ["A" , "B" ], combine_labels_with = "AND" , allow_disconnected_nodes = True )
120123
121124 assert G .name () == "g"
122- assert runner .last_params () == dict (
123- graph_name = "g" , data_config = {"sourceNodeLabels" : ["A" , "B" ], "targetNodeLabels" : ["A" , "B" ]}
124- )
125+ assert runner .last_params () == {
126+ "graph_name" : "g" ,
127+ "data_config" : {"sourceNodeLabels" : ["A" , "B" ], "targetNodeLabels" : ["A" , "B" ]},
128+ }
125129
126130 assert (
127131 runner .last_query ()
@@ -136,7 +140,7 @@ def test_multiple_node_labels_or(runner: CollectingQueryRunner, gds: GraphDataSc
136140 G , _ = gds .graph .cypher .project ("g" , nodes = ["A" , "B" ], combine_labels_with = "OR" )
137141
138142 assert G .name () == "g"
139- assert runner .last_params () == dict ( graph_name = "g" )
143+ assert runner .last_params () == { " graph_name" : "g" }
140144
141145 assert runner .last_query () == (
142146 """MATCH (source)-->(target)
@@ -152,7 +156,7 @@ def test_disconnected_nodes_multiple_node_labels_or(runner: CollectingQueryRunne
152156 G , _ = gds .graph .cypher .project ("g" , nodes = ["A" , "B" ], combine_labels_with = "OR" , allow_disconnected_nodes = True )
153157
154158 assert G .name () == "g"
155- assert runner .last_params () == dict ( graph_name = "g" )
159+ assert runner .last_params () == { " graph_name" : "g" }
156160
157161 assert runner .last_query () == (
158162 """MATCH (source)
@@ -170,10 +174,10 @@ def test_single_multi_graph(runner: CollectingQueryRunner, gds: GraphDataScience
170174 G , _ = gds .graph .cypher .project ("g" , nodes = "A" , relationships = "REL" )
171175
172176 assert G .name () == "g"
173- assert runner .last_params () == dict (
174- graph_name = "g" ,
175- data_config = {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ], "relationshipType" : "REL" },
176- )
177+ assert runner .last_params () == {
178+ " graph_name" : "g" ,
179+ " data_config" : {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ], "relationshipType" : "REL" },
180+ }
177181
178182 assert (
179183 runner .last_query ()
@@ -187,10 +191,10 @@ def test_disconnected_nodes_single_multi_graph(runner: CollectingQueryRunner, gd
187191 G , _ = gds .graph .cypher .project ("g" , nodes = "A" , relationships = "REL" , allow_disconnected_nodes = True )
188192
189193 assert G .name () == "g"
190- assert runner .last_params () == dict (
191- graph_name = "g" ,
192- data_config = {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ], "relationshipType" : "REL" },
193- )
194+ assert runner .last_params () == {
195+ " graph_name" : "g" ,
196+ " data_config" : {"sourceNodeLabels" : ["A" ], "targetNodeLabels" : ["A" ], "relationshipType" : "REL" },
197+ }
194198
195199 assert (
196200 runner .last_query ()
@@ -205,7 +209,7 @@ def test_multiple_multi_graph(runner: CollectingQueryRunner, gds: GraphDataScien
205209 G , _ = gds .graph .cypher .project ("g" , nodes = ["A" , "B" ], relationships = ["REL1" , "REL2" ])
206210
207211 assert G .name () == "g"
208- assert runner .last_params () == dict ( graph_name = "g" )
212+ assert runner .last_params () == { " graph_name" : "g" }
209213
210214 assert (
211215 runner .last_query ()
@@ -220,15 +224,12 @@ def test_multiple_multi_graph(runner: CollectingQueryRunner, gds: GraphDataScien
220224
221225@pytest .mark .parametrize ("server_version" , [ServerVersion (2 , 4 , 0 )])
222226def test_node_properties (runner : CollectingQueryRunner , gds : GraphDataScience ) -> None :
223- # G, _ = gds.graph.cypher.project(
224- # "g", nodes=dict(L1=["prop1"], L2=["prop2", "prop3"], L3=dict(prop4=True, prop5=dict()))
225- # )
226227 G , _ = gds .graph .cypher .project (
227228 "g" , nodes = {"L1" : ["prop1" ], "L2" : ["prop2" , "prop3" ], "L3" : {"prop4" : True , "prop5" : {}}}
228229 )
229230
230231 assert G .name () == "g"
231- assert runner .last_params () == dict ( graph_name = "g" )
232+ assert runner .last_params () == { " graph_name" : "g" }
232233
233234 assert runner .last_query () == (
234235 """MATCH (source)-->(target)
@@ -256,11 +257,11 @@ def test_node_properties(runner: CollectingQueryRunner, gds: GraphDataScience) -
256257@pytest .mark .parametrize ("server_version" , [ServerVersion (2 , 4 , 0 )])
257258def test_node_properties_alias (runner : CollectingQueryRunner , gds : GraphDataScience ) -> None :
258259 G , _ = gds .graph .cypher .project (
259- "g" , nodes = dict ( A = dict ( target_prop1 = " source_prop1" , target_prop2 = dict ( property_key = " source_prop2")))
260+ "g" , nodes = { "A" : { " target_prop1" : " source_prop1" , " target_prop2" : { " property_key" : " source_prop2"}}}
260261 )
261262
262263 assert G .name () == "g"
263- assert runner .last_params () == dict ( graph_name = "g" )
264+ assert runner .last_params () == { " graph_name" : "g" }
264265
265266 assert runner .last_query () == (
266267 """MATCH (source:A)-->(target:A)
0 commit comments