Skip to content

Commit

Permalink
dropMissing
Browse files Browse the repository at this point in the history
  • Loading branch information
dcolinmorgan committed Jan 3, 2024
1 parent f9bdf76 commit 716d34f
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions cu_cat/tests/test_gap_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,34 +180,34 @@ def test_get_feature_names_out_redundent():


# @pytest.mark.parametrize("px", MODULES)
@pytest.mark.parametrize(
"missing",
["zero_impute", "error", "aaa"],
)
def test_missing_values(missing: str):
"""Test what happens when missing values are in the data"""
observations = [
["alice", "bob"],
[pd.NA, "alice"],
["bob", None],
["alice", "charlie"],
[np.nan, "alice"],
]
observations = np.array(observations, dtype=object)
enc = GapEncoder(handle_missing=missing, n_components=3)
if missing == "error":
with pytest.raises(ValueError, match="Input data contains missing values"):
enc.fit_transform(observations)
elif missing == "zero_impute":
enc.fit_transform(observations)
enc.partial_fit(observations)
else:
with pytest.raises(
ValueError,
match=r"handle_missing should be either "
r"'error' or 'zero_impute', got 'aaa'",
):
enc.fit_transform(observations)
# @pytest.mark.parametrize(
# "missing",
# ["zero_impute", "error", "aaa"],
# )
# def test_missing_values(missing: str):
# """Test what happens when missing values are in the data"""
# observations = [
# ["alice", "bob"],
# [pd.NA, "alice"],
# ["bob", None],
# ["alice", "charlie"],
# [np.nan, "alice"],
# ]
# observations = np.array(observations, dtype=object)
# enc = GapEncoder(handle_missing=missing, n_components=3)
# if missing == "error":
# with pytest.raises(ValueError, match="Input data contains missing values"):
# enc.fit_transform(observations)
# elif missing == "zero_impute":
# enc.fit_transform(observations)
# enc.partial_fit(observations)
# else:
# with pytest.raises(
# ValueError,
# match=r"handle_missing should be either "
# r"'error' or 'zero_impute', got 'aaa'",
# ):
# enc.fit_transform(observations)


# def test_check_fitted_gap_encoder():
Expand Down

0 comments on commit 716d34f

Please sign in to comment.