@@ -220,8 +220,11 @@ def test_multiple_multi_graph(runner: CollectingQueryRunner, gds: GraphDataScien
220
220
221
221
@pytest .mark .parametrize ("server_version" , [ServerVersion (2 , 4 , 0 )])
222
222
def 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
+ # )
223
226
G , _ = gds .graph .cypher .project (
224
- "g" , nodes = dict ( L1 = ["prop1" ], L2 = ["prop2" , "prop3" ], L3 = dict ( prop4 = True , prop5 = dict ()))
227
+ "g" , nodes = { "L1" : ["prop1" ], "L2" : ["prop2" , "prop3" ], "L3" : { " prop4" : True , " prop5" : {}}}
225
228
)
226
229
227
230
assert G .name () == "g"
@@ -247,3 +250,25 @@ def test_node_properties(runner: CollectingQueryRunner, gds: GraphDataScience) -
247
250
"sourceNodeProperties: sourceNodeProperties, "
248
251
"targetNodeProperties: targetNodeProperties})"
249
252
)
253
+
254
+
255
+ @pytest .mark .parametrize ("server_version" , [ServerVersion (2 , 4 , 0 )])
256
+ def test_node_properties_alias (runner : CollectingQueryRunner , gds : GraphDataScience ) -> None :
257
+ G , _ = gds .graph .cypher .project (
258
+ "g" , nodes = dict (A = dict (target_prop1 = "source_prop1" , target_prop2 = dict (property_key = "source_prop2" )))
259
+ )
260
+
261
+ assert G .name () == "g"
262
+ assert runner .last_params () == dict (graph_name = "g" )
263
+
264
+ assert runner .last_query () == (
265
+ """MATCH (source:A)-->(target:A)
266
+ WITH source, target, """
267
+ "[{target_prop1: source.source_prop1, target_prop1: source.source_prop2}] AS sourceNodeProperties"
268
+ """[{target_prop1: target.source_prop1, target_prop1: target.source_prop2}] AS targetNodeProperties
269
+ RETURN gds.graph.project($graph_name, source, target, {"""
270
+ "sourceNodeLabels: labels(source), "
271
+ "targetNodeLabels: labels(target), "
272
+ "sourceNodeProperties: sourceNodeProperties, "
273
+ "targetNodeProperties: targetNodeProperties})"
274
+ )
0 commit comments