Skip to content

Commit

Permalink
simple things to get ci unblocked
Browse files Browse the repository at this point in the history
  • Loading branch information
isVoid committed Feb 18, 2022
1 parent d5d209c commit 1754580
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions python/cudf/cudf/core/df_protocol.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2021-2022, NVIDIA CORPORATION.

import collections
import enum
from typing import (
Expand Down
16 changes: 12 additions & 4 deletions python/cudf/cudf/tests/test_df_protocol.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (c) 2021-2022, NVIDIA CORPORATION.

from typing import Any, Tuple

import cupy as cp
Expand Down Expand Up @@ -27,13 +29,19 @@ def assert_buffer_equal(buffer_and_dtype: Tuple[_CuDFBuffer, Any], cudfcol):
)
# check that non null values are the equals as nulls are represented
# by sentinel values in the buffer.
non_null_idxs = cudf.Series(cudfcol) != cudf.NA
# FIXME: In gh-10202 some minimal fixes were added to unblock CI. But
# currently only non-null values are compared, null positions are
# unchecked.
non_null_idxs = ~cudf.Series(cudfcol).isna()
assert_eq(col_from_buf[non_null_idxs], cudfcol[non_null_idxs])

if dtype[0] != _DtypeKind.BOOL:
array_from_dlpack = cp.fromDlpack(buf.__dlpack__())
col_array = cp.asarray(cudfcol.data_array_view)
assert_eq(array_from_dlpack.flatten(), col_array.flatten())
array_from_dlpack = cp.fromDlpack(buf.__dlpack__()).get()
col_array = cp.asarray(cudfcol.data_array_view).get()
assert_eq(
array_from_dlpack[non_null_idxs.to_numpy()].flatten(),
col_array[non_null_idxs.to_numpy()].flatten(),
)
else:
pytest.raises(TypeError, buf.__dlpack__)

Expand Down

0 comments on commit 1754580

Please sign in to comment.