@@ -220,8 +220,11 @@ def test_multiple_multi_graph(runner: CollectingQueryRunner, gds: GraphDataScien
220220
221221@pytest .mark .parametrize ("server_version" , [ServerVersion (2 , 4 , 0 )])
222222def 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+ # )
223226 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" : {}}}
225228 )
226229
227230 assert G .name () == "g"
@@ -247,3 +250,25 @@ def test_node_properties(runner: CollectingQueryRunner, gds: GraphDataScience) -
247250 "sourceNodeProperties: sourceNodeProperties, "
248251 "targetNodeProperties: targetNodeProperties})"
249252 )
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