Skip to content

Commit 35deba4

Browse files
committed
Remove deprecated streamRelationshipPropertyies and add warning in tests
1 parent ffe2012 commit 35deba4

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

graphdatascience/tests/integration/test_graph_ops.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ def test_graph_nodeProperties_stream_without_arrow_separate_property_columns(
473473
def test_graph_streamRelationshipProperty_with_arrow(gds: GraphDataScience) -> None:
474474
G, _ = gds.graph.project(GRAPH_NAME, "*", {"REL": {"properties": "relX"}})
475475

476-
result = gds.graph.streamRelationshipProperty(G, "relX", concurrency=2)
476+
with pytest.warns(DeprecationWarning):
477+
result = gds.graph.streamRelationshipProperty(G, "relX", concurrency=2)
477478
assert {e for e in result["propertyValue"]} == {4, 5, 6}
478479

479480

@@ -488,7 +489,8 @@ def test_graph_relationshipProperty_stream_with_arrow(gds: GraphDataScience) ->
488489
def test_graph_streamRelationshipProperty_without_arrow(gds_without_arrow: GraphDataScience) -> None:
489490
G, _ = gds_without_arrow.graph.project(GRAPH_NAME, "*", {"REL": {"properties": "relX"}})
490491

491-
result = gds_without_arrow.graph.streamRelationshipProperty(G, "relX", concurrency=2)
492+
with pytest.warns(DeprecationWarning):
493+
result = gds_without_arrow.graph.streamRelationshipProperty(G, "relX", concurrency=2)
492494
assert {e for e in result["propertyValue"]} == {4, 5, 6}
493495

494496

@@ -503,7 +505,8 @@ def test_graph_relationshipProperty_stream_without_arrow(gds_without_arrow: Grap
503505
def test_graph_streamRelationshipProperties_with_arrow(gds: GraphDataScience) -> None:
504506
G, _ = gds.graph.project(GRAPH_NAME, "*", {"REL": {"properties": ["relX", "relY"]}})
505507

506-
result = gds.graph.streamRelationshipProperties(G, ["relX", "relY"], concurrency=2)
508+
with pytest.warns(DeprecationWarning):
509+
result = gds.graph.streamRelationshipProperties(G, ["relX", "relY"], concurrency=2)
507510

508511
assert list(result.keys()) == [
509512
"sourceNodeId",
@@ -542,7 +545,10 @@ def test_graph_relationshipProperties_stream_with_arrow(gds: GraphDataScience) -
542545
def test_graph_streamRelationshipProperties_with_arrow_separate_property_columns(gds: GraphDataScience) -> None:
543546
G, _ = gds.graph.project(GRAPH_NAME, "*", {"REL": {"properties": ["relX", "relY"]}})
544547

545-
result = gds.graph.streamRelationshipProperties(G, ["relX", "relY"], separate_property_columns=True, concurrency=2)
548+
with pytest.warns(DeprecationWarning):
549+
result = gds.graph.streamRelationshipProperties(
550+
G, ["relX", "relY"], separate_property_columns=True, concurrency=2
551+
)
546552

547553
assert list(result.keys()) == ["sourceNodeId", "targetNodeId", "relationshipType", "relX", "relY"]
548554
assert {e for e in result["relX"]} == {4, 5, 6}
@@ -563,7 +569,8 @@ def test_graph_relationshipProperties_stream_with_arrow_separate_property_column
563569
def test_graph_streamRelationshipProperties_without_arrow(gds_without_arrow: GraphDataScience) -> None:
564570
G, _ = gds_without_arrow.graph.project(GRAPH_NAME, "*", {"REL": {"properties": ["relX", "relY"]}})
565571

566-
result = gds_without_arrow.graph.streamRelationshipProperties(G, ["relX", "relY"], concurrency=2)
572+
with pytest.warns(DeprecationWarning):
573+
result = gds_without_arrow.graph.streamRelationshipProperties(G, ["relX", "relY"], concurrency=2)
567574

568575
assert list(result.keys()) == [
569576
"sourceNodeId",
@@ -604,9 +611,10 @@ def test_graph_streamRelationshipProperties_without_arrow_separate_property_colu
604611
) -> None:
605612
G, _ = gds_without_arrow.graph.project(GRAPH_NAME, "*", {"REL": {"properties": ["relX", "relY"]}})
606613

607-
result = gds_without_arrow.graph.streamRelationshipProperties(
608-
G, ["relX", "relY"], separate_property_columns=True, concurrency=2
609-
)
614+
with pytest.warns(DeprecationWarning):
615+
result = gds_without_arrow.graph.streamRelationshipProperties(
616+
G, ["relX", "relY"], separate_property_columns=True, concurrency=2
617+
)
610618

611619
assert list(result.keys()) == ["sourceNodeId", "targetNodeId", "relationshipType", "relX", "relY"]
612620
assert {e for e in result["relX"]} == {4, 5, 6}

graphdatascience/tests/unit/test_graph_ops.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def test_graph_nodeProperties_stream(runner: CollectingQueryRunner, gds: GraphDa
223223
def test_graph_streamRelationshipProperty(runner: CollectingQueryRunner, gds: GraphDataScience) -> None:
224224
G, _ = gds.graph.project("g", "*", "*")
225225

226-
gds.graph.streamRelationshipProperty(G, "dummyProp", concurrency=2)
226+
with pytest.warns(DeprecationWarning):
227+
gds.graph.streamRelationshipProperty(G, "dummyProp", concurrency=2)
227228
assert (
228229
runner.last_query() == "CALL gds.graph.streamRelationshipProperty($graph_name, $properties, $entities, $config)"
229230
)
@@ -234,7 +235,8 @@ def test_graph_streamRelationshipProperty(runner: CollectingQueryRunner, gds: Gr
234235
"config": {"concurrency": 2},
235236
}
236237

237-
gds.graph.streamRelationshipProperty(G, "dummyProp", "dummyType", concurrency=2)
238+
with pytest.warns(DeprecationWarning):
239+
gds.graph.streamRelationshipProperty(G, "dummyProp", "dummyType", concurrency=2)
238240
assert (
239241
runner.last_query() == "CALL gds.graph.streamRelationshipProperty($graph_name, $properties, $entities, $config)"
240242
)
@@ -292,7 +294,8 @@ def test_graph_streamRelationshipProperties(runner: CollectingQueryRunner, gds:
292294

293295
runner.set__mock_result(result_df)
294296

295-
gds.graph.streamRelationshipProperties(G, ["dummyProp"], concurrency=2)
297+
with pytest.warns(DeprecationWarning):
298+
gds.graph.streamRelationshipProperties(G, ["dummyProp"], concurrency=2)
296299
assert (
297300
runner.last_query()
298301
== "CALL gds.graph.streamRelationshipProperties($graph_name, $properties, $entities, $config)"
@@ -304,7 +307,8 @@ def test_graph_streamRelationshipProperties(runner: CollectingQueryRunner, gds:
304307
"config": {"concurrency": 2},
305308
}
306309

307-
gds.graph.streamRelationshipProperties(G, ["dummyProp"], "dummyType", concurrency=2)
310+
with pytest.warns(DeprecationWarning):
311+
gds.graph.streamRelationshipProperties(G, ["dummyProp"], "dummyType", concurrency=2)
308312
assert (
309313
runner.last_query()
310314
== "CALL gds.graph.streamRelationshipProperties($graph_name, $properties, $entities, $config)"

0 commit comments

Comments
 (0)