Skip to content

Commit

Permalink
Fix tests for MG property graph (#3090)
Browse files Browse the repository at this point in the history
Small PR to fix MGPG tests.

Note that @galipremsagar fixed the equivalent tests for `test_property_graph.py` in #3036 by using `s._constructor`, which is pretty slick.

Also, `start_dask_client` returns a tuple of client and cluster now, so I updated the `dask_client` fixture so the cluster can be closed properly.

Authors:
  - Erik Welch (https://github.com/eriknw)
  - Alex Barghi (https://github.com/alexbarghi-nv)

Approvers:
  - Alex Barghi (https://github.com/alexbarghi-nv)
  - Rick Ratzel (https://github.com/rlratzel)

URL: #3090
  • Loading branch information
eriknw authored Jan 12, 2023
1 parent 73d5cc5 commit 5c240dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions python/cugraph/cugraph/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022, NVIDIA CORPORATION.
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -32,7 +32,7 @@ def gpubenchmark():

@pytest.fixture(scope="module")
def dask_client():
client = start_dask_client(
client, cluster = start_dask_client(
enable_tcp_over_ucx=True,
enable_nvlink=True,
enable_infiniband=True,
Expand Down
13 changes: 5 additions & 8 deletions python/cugraph/cugraph/tests/mg/test_mg_property_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,14 +866,12 @@ def test_renumber_vertices_by_type(dataset1_MGPropertyGraph, prev_id_column):
assert df_id_ranges.loc[key, "stop"] == stop
df = pG.get_vertex_data(types=[key]).compute().to_pandas()
assert len(df) == stop - start + 1
assert (
df["_VERTEX_"] == df["_VERTEX_"]._constructor(range(start, stop + 1))
).all()
assert (df["_VERTEX_"] == cudf.Series(range(start, stop + 1))).all()
if prev_id_column is not None:
cur = df[prev_id_column].sort_values()
expected = sorted(x for x, *args in data[key][1])
expected = cur._constructor(sorted(x for x, *args in data[key][1]))
assert (cur.values == expected.values).all()
assert (cur == cudf.Series(expected, index=cur.index)).all()

# Make sure we renumber vertex IDs in edge data too
df = pG.get_edge_data().compute()
assert 0 <= df[pG.src_col_name].min() < df[pG.src_col_name].max() < 9
Expand Down Expand Up @@ -908,9 +906,8 @@ def test_renumber_edges_by_type(dataset1_MGPropertyGraph, prev_id_column):
assert df_id_ranges.loc[key, "stop"] == stop
df = pG.get_edge_data(types=[key]).compute().to_pandas()
assert len(df) == stop - start + 1
actual = df[pG.edge_id_col_name]
expected = actual._constructor(range(start, stop + 1))
assert (actual == expected).all()
assert (df[pG.edge_id_col_name] == cudf.Series(range(start, stop + 1))).all()

if prev_id_column is not None:
assert prev_id_column in df.columns

Expand Down

0 comments on commit 5c240dd

Please sign in to comment.