66
77from graphdatascience .graph_data_science import GraphDataScience
88from graphdatascience .query_runner .arrow_query_runner import ArrowQueryRunner
9- from graphdatascience .query_runner .neo4j_query_runner import Neo4jQueryRunner
109from graphdatascience .query_runner .query_runner import QueryRunner
1110from graphdatascience .server_version .server_version import ServerVersion
1211from graphdatascience .tests .integration .conftest import AUTH , DB , URI
1514
1615
1716@pytest .fixture (autouse = True )
18- def run_around_tests (runner : Neo4jQueryRunner ) -> Generator [None , None , None ]:
17+ def run_around_tests (gds : GraphDataScience ) -> Generator [None , None , None ]:
1918 # Runs before each test
20- runner .run_cypher (
19+ gds .run_cypher (
2120 """
2221 CREATE
2322 (a: Node {x: 1, y: 2, z: [42], name: "nodeA"}),
@@ -33,8 +32,8 @@ def run_around_tests(runner: Neo4jQueryRunner) -> Generator[None, None, None]:
3332 yield # Test runs here
3433
3534 # Runs after each test
36- runner .run_cypher ("MATCH (n) DETACH DELETE n" )
37- runner . run_cypher ( f"CALL gds.graph.drop(' { GRAPH_NAME } ', false)" )
35+ gds .run_cypher ("MATCH (n) DETACH DELETE n" )
36+ gds .graph .drop (GRAPH_NAME , failIfMissing = False )
3837
3938
4039def test_project_graph_native (gds : GraphDataScience ) -> None :
@@ -109,7 +108,7 @@ def test_beta_project_subgraph(runner: QueryRunner, gds: GraphDataScience) -> No
109108 result2 = gds .graph .list (sub_G )
110109 assert result2 ["nodeCount" ][0 ] == 2
111110
112- runner . run_cypher ( f"CALL gds.graph.drop(' { sub_G . name () } ')" )
111+ gds .graph .drop (sub_G )
113112
114113
115114@pytest .mark .compatible_with (min_inclusive = ServerVersion (2 , 5 , 0 ))
@@ -124,7 +123,7 @@ def test_project_subgraph(runner: QueryRunner, gds: GraphDataScience) -> None:
124123 result2 = gds .graph .list (sub_G )
125124 assert result2 ["nodeCount" ][0 ] == 2
126125
127- runner . run_cypher ( f"CALL gds.graph.drop(' { sub_G . name () } ')" )
126+ gds .graph .drop (sub_G )
128127
129128
130129@pytest .mark .compatible_with (min_inclusive = ServerVersion (2 , 4 , 0 ))
@@ -139,7 +138,7 @@ def test_sample_rwr(runner: QueryRunner, gds: GraphDataScience) -> None:
139138 result2 = gds .graph .list (rwr_G )
140139 assert result2 ["nodeCount" ][0 ] == 2
141140
142- runner . run_cypher ( f"CALL gds.graph.drop(' { rwr_G . name () } ')" )
141+ gds .graph .drop (rwr_G )
143142
144143
145144@pytest .mark .skip_on_aura # The alpha procedure is not part of the allowlist
@@ -159,7 +158,7 @@ def test_sample_rwr_alpha(runner: QueryRunner, gds: GraphDataScience) -> None:
159158 result2 = gds .graph .list (rwr_G )
160159 assert result2 ["nodeCount" ][0 ] == 2
161160
162- runner . run_cypher ( f"CALL gds.graph.drop(' { rwr_G . name () } ')" )
161+ gds .graph .drop (rwr_G )
163162
164163
165164@pytest .mark .compatible_with (min_inclusive = ServerVersion (2 , 4 , 0 ))
@@ -174,7 +173,7 @@ def test_sample_cnarw(runner: QueryRunner, gds: GraphDataScience) -> None:
174173 result2 = gds .graph .list (cnarw_G )
175174 assert result2 ["nodeCount" ][0 ] == 2
176175
177- runner . run_cypher ( f"CALL gds.graph.drop(' { cnarw_G . name () } ')" )
176+ gds .graph .drop (cnarw_G )
178177
179178
180179@pytest .mark .compatible_with (min_inclusive = ServerVersion (2 , 4 , 0 ))
@@ -253,7 +252,7 @@ def test_graph_type_check(gds: GraphDataScience) -> None:
253252 "To resolve a graph name string into a `Graph` object, please use `gds.graph.get`"
254253 ),
255254 ):
256- gds .graph .drop (G .name (), True ) # type: ignore
255+ gds .graph .list (G .name ()) # type: ignore
257256
258257 result = gds .graph .drop (G , True )
259258 assert result is not None
0 commit comments