Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Palazzo committed Aug 10, 2023
1 parent f95d925 commit df0ad68
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/unit/transformers/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ def test___repr___default(self):
def test__fit(self):
"""Test the ``_fit`` method."""
# Setup
data = pd.Series([1, 2, 3, 2, None, 1, 1])
transformer = OrderedUniformEncoder(order=[2, 3, None, 1])
data = pd.Series([1, 2, 3, 2, np.nan, 1, 1])
transformer = OrderedUniformEncoder(order=[2, 3, np.nan, 1])

# Run
transformer._fit(data)
Expand Down Expand Up @@ -446,20 +446,16 @@ def test__transform_error(self):
If the data being transformed is not in ``self.order`` an error should be raised.
"""
# Setup
data_error = pd.Series([1, 2, 3, 2, 1, 4])
data = pd.Series([1, 2, 1, 2, 1, 1])
data = pd.Series([1, 2, 3, 2, 1, 4])
transformer = OrderedUniformEncoder(order=[2, 1])

# Run / Assert
transformer._fit(data)
transformer._transform(data)

message = re.escape(
"Unknown categories '[3, 4]'. All possible categories must be defined in the "
"'order' parameter."
)
with pytest.raises(TransformerInputError, match=message):
transformer._transform(data_error)
transformer._transform(data)


class TestFrequencyEncoder:
Expand Down

0 comments on commit df0ad68

Please sign in to comment.