Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions python/cuml/tests/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,11 @@
import warnings

import cudf
import cudf.pandas
import numpy as np
import pytest

import cuml

cudf_pandas_active = cudf.pandas.LOADED

_XFAIL_CUDF_PANDAS_21695 = pytest.mark.xfail(
reason="rapidsai/cudf#21695: cudf.Series.astype(str) raises TypeError under cudf.pandas",
strict=True,
)


def _name_in_all(parent, name):
return name in getattr(parent, "__all__", [])
Expand Down Expand Up @@ -87,17 +79,9 @@ def _find_doctests_in_obj(obj, finder=None, criteria=None):
yield from _find_doctests_in_obj(member, finder)


def _doctest_params():
for docstring in _find_doctests_in_obj(cuml):
if docstring.name == "LabelEncoder" and cudf_pandas_active:
yield pytest.param(docstring, marks=_XFAIL_CUDF_PANDAS_21695)
else:
yield docstring


@pytest.mark.parametrize(
"docstring",
_doctest_params(),
_find_doctests_in_obj(cuml),
ids=lambda docstring: docstring.name,
)
def test_docstring(docstring):
Expand Down
8 changes: 0 additions & 8 deletions python/cuml/tests/test_label_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: Apache-2.0

import cudf
import cudf.pandas
import cupy as cp
import numpy as np
import pandas as pd
Expand All @@ -12,8 +11,6 @@

from cuml.preprocessing.LabelEncoder import LabelEncoder

cudf_pandas_active = cudf.pandas.LOADED


def _df_to_similarity_mat(df):
arr = df.to_numpy().reshape(1, -1)
Expand Down Expand Up @@ -77,11 +74,6 @@ def test_labelencoder_unfitted():
le.transform(df)


@pytest.mark.xfail(
cudf_pandas_active,
reason="rapidsai/cudf#21695: cudf.Series.astype(str) raises TypeError under cudf.pandas",
strict=True,
)
@pytest.mark.parametrize("use_fit_transform", [False, True])
@pytest.mark.parametrize(
"orig_label, ord_label, expected_reverted, bad_ord_label",
Expand Down
27 changes: 2 additions & 25 deletions python/cuml/tests/test_one_hot_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
import math

import cudf.pandas
import cupy as cp
import numpy as np
import pandas as pd
Expand All @@ -18,8 +17,6 @@
stress_param,
)

cudf_pandas_active = cudf.pandas.LOADED


def _from_df_to_cupy(df):
"""Transform char columns to integer columns, and then create an array"""
Expand Down Expand Up @@ -170,17 +167,7 @@ def test_onehot_random_inputs(drop, sparse, n_samples, as_array):

@pytest.mark.parametrize(
"as_array",
[
True,
pytest.param(
False,
marks=pytest.mark.xfail(
condition=cudf_pandas_active,
reason="rapidsai/cudf#21695: cudf.Series.astype(str) raises TypeError under cudf.pandas",
strict=True,
),
),
],
[True, False],
ids=["cupy", "cudf"],
)
def test_onehot_drop_idx_first(as_array):
Expand All @@ -203,17 +190,7 @@ def test_onehot_drop_idx_first(as_array):

@pytest.mark.parametrize(
"as_array",
[
True,
pytest.param(
False,
marks=pytest.mark.xfail(
condition=cudf_pandas_active,
reason="rapidsai/cudf#21695: cudf.Series.astype(str) raises TypeError under cudf.pandas",
strict=True,
),
),
],
[True, False],
ids=["cupy", "cudf"],
)
def test_onehot_drop_one_of_each(as_array):
Expand Down
8 changes: 0 additions & 8 deletions python/cuml/tests/test_ordinal_encoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
import cudf.pandas
import cupy as cp
import numpy as np
import pandas as pd
Expand All @@ -10,20 +9,13 @@

from cuml.preprocessing import OrdinalEncoder

cudf_pandas_active = cudf.pandas.LOADED


@pytest.fixture
def test_sample():
X = DataFrame({"cat": ["M", "F", "F"], "num": [1, 3, 2]})
return X


@pytest.mark.xfail(
cudf_pandas_active,
reason="rapidsai/cudf#21695: cudf.Series.astype(str) raises TypeError under cudf.pandas",
strict=True,
)
def test_ordinal_encoder_df(test_sample) -> None:
X = test_sample
enc = OrdinalEncoder()
Expand Down
Loading