@@ -168,17 +168,20 @@ def test_graph_streamNodeProperties(gds: GraphDataScience) -> None:
168
168
169
169
result = gds .graph .streamNodeProperties (G , ["x" , "y" ], concurrency = 2 )
170
170
171
+ assert list (result .keys ()) == ["nodeId" , "nodeProperty" , "propertyValue" ]
172
+
171
173
x_values = result [result .nodeProperty == "x" ]
172
174
assert {e for e in x_values ["propertyValue" ]} == {1 , 2 , 3 }
173
175
174
176
y_values = result [result .nodeProperty == "y" ]
175
177
assert {e for e in y_values ["propertyValue" ]} == {2 , 3 , 4 }
176
178
177
179
178
- def test_graph_streamNodeProperties_merge_property_columns (gds : GraphDataScience ) -> None :
180
+ def test_graph_streamNodeProperties_separate_property_columns (gds : GraphDataScience ) -> None :
179
181
G , _ = gds .graph .project (GRAPH_NAME , {"Node" : {"properties" : ["x" , "y" ]}}, "*" )
180
182
181
183
result = gds .graph .streamNodeProperties (G , ["x" , "y" ], separate_property_columns = True , concurrency = 2 )
184
+ assert list (result .keys ()) == ["nodeId" , "x" , "y" ]
182
185
assert {e for e in result ["x" ]} == {1 , 2 , 3 }
183
186
assert {e for e in result ["y" ]} == {2 , 3 , 4 }
184
187
@@ -187,17 +190,24 @@ def test_graph_streamNodeProperties_without_arrow(gds_without_arrow: GraphDataSc
187
190
G , _ = gds_without_arrow .graph .project (GRAPH_NAME , {"Node" : {"properties" : ["x" , "y" ]}}, "*" )
188
191
189
192
result = gds_without_arrow .graph .streamNodeProperties (G , ["x" , "y" ], concurrency = 2 )
193
+
194
+ assert list (result .keys ()) == ["nodeId" , "nodeProperty" , "propertyValue" ]
195
+
190
196
x_values = result [result .nodeProperty == "x" ]
191
197
assert {e for e in x_values ["propertyValue" ]} == {1 , 2 , 3 }
192
198
193
199
y_values = result [result .nodeProperty == "y" ]
194
200
assert {e for e in y_values ["propertyValue" ]} == {2 , 3 , 4 }
195
201
196
202
197
- def test_graph_streamNodeProperties_without_arrow_merge_property_columns (gds_without_arrow : GraphDataScience ) -> None :
203
+ def test_graph_streamNodeProperties_without_arrow_separate_property_columns (
204
+ gds_without_arrow : GraphDataScience ,
205
+ ) -> None :
198
206
G , _ = gds_without_arrow .graph .project (GRAPH_NAME , {"Node" : {"properties" : ["x" , "y" ]}}, "*" )
199
207
200
208
result = gds_without_arrow .graph .streamNodeProperties (G , ["x" , "y" ], separate_property_columns = True , concurrency = 2 )
209
+
210
+ assert list (result .keys ()) == ["nodeId" , "x" , "y" ]
201
211
assert {e for e in result ["x" ]} == {1 , 2 , 3 }
202
212
assert {e for e in result ["y" ]} == {2 , 3 , 4 }
203
213
@@ -221,17 +231,26 @@ def test_graph_streamRelationshipProperties(gds: GraphDataScience) -> None:
221
231
222
232
result = gds .graph .streamRelationshipProperties (G , ["relX" , "relY" ], concurrency = 2 )
223
233
234
+ assert list (result .keys ()) == [
235
+ "sourceNodeId" ,
236
+ "targetNodeId" ,
237
+ "relationshipType" ,
238
+ "relationshipProperty" ,
239
+ "propertyValue" ,
240
+ ]
241
+
224
242
x_values = result [result .relationshipProperty == "relX" ]
225
243
assert {e for e in x_values ["propertyValue" ]} == {4 , 5 , 6 }
226
244
y_values = result [result .relationshipProperty == "relY" ]
227
245
assert {e for e in y_values ["propertyValue" ]} == {5 , 6 , 7 }
228
246
229
247
230
- def test_graph_streamRelationshipProperties_merge_property_columns (gds : GraphDataScience ) -> None :
248
+ def test_graph_streamRelationshipProperties_separate_property_columns (gds : GraphDataScience ) -> None :
231
249
G , _ = gds .graph .project (GRAPH_NAME , "*" , {"REL" : {"properties" : ["relX" , "relY" ]}})
232
250
233
251
result = gds .graph .streamRelationshipProperties (G , ["relX" , "relY" ], separate_property_columns = True , concurrency = 2 )
234
- assert {e for e in result ["relationshipType" ]} == {"REL" , "REL" , "REL" }
252
+
253
+ assert list (result .keys ()) == ["sourceNodeId" , "targetNodeId" , "relationshipType" , "relX" , "relY" ]
235
254
assert {e for e in result ["relX" ]} == {4 , 5 , 6 }
236
255
assert {e for e in result ["relY" ]} == {5 , 6 , 7 }
237
256
@@ -241,20 +260,30 @@ def test_graph_streamRelationshipProperties_without_arrow(gds_without_arrow: Gra
241
260
242
261
result = gds_without_arrow .graph .streamRelationshipProperties (G , ["relX" , "relY" ], concurrency = 2 )
243
262
263
+ assert list (result .keys ()) == [
264
+ "sourceNodeId" ,
265
+ "targetNodeId" ,
266
+ "relationshipType" ,
267
+ "relationshipProperty" ,
268
+ "propertyValue" ,
269
+ ]
270
+
244
271
x_values = result [result .relationshipProperty == "relX" ]
245
272
assert {e for e in x_values ["propertyValue" ]} == {4 , 5 , 6 }
246
273
y_values = result [result .relationshipProperty == "relY" ]
247
274
assert {e for e in y_values ["propertyValue" ]} == {5 , 6 , 7 }
248
275
249
276
250
- def test_graph_streamRelationshipProperties_without_arrow_merge_property_columns (
277
+ def test_graph_streamRelationshipProperties_without_arrow_separate_property_columns (
251
278
gds_without_arrow : GraphDataScience ,
252
279
) -> None :
253
280
G , _ = gds_without_arrow .graph .project (GRAPH_NAME , "*" , {"REL" : {"properties" : ["relX" , "relY" ]}})
254
281
255
282
result = gds_without_arrow .graph .streamRelationshipProperties (
256
283
G , ["relX" , "relY" ], separate_property_columns = True , concurrency = 2
257
284
)
285
+
286
+ assert list (result .keys ()) == ["sourceNodeId" , "targetNodeId" , "relationshipType" , "relX" , "relY" ]
258
287
assert {e for e in result ["relX" ]} == {4 , 5 , 6 }
259
288
assert {e for e in result ["relY" ]} == {5 , 6 , 7 }
260
289
0 commit comments