Skip to content

Commit

Permalink
No warning test case added
Browse files Browse the repository at this point in the history
  • Loading branch information
Boluwatife28 committed Mar 3, 2025
1 parent eed7eb1 commit 33534de
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/nominal/test_OneHotEncodingTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,13 @@ def test_fit_no_warning_if_all_wanted_values_present(self, library):
df = d.create_df_1(library=library)

transformer = OneHotEncodingTransformer(
columns=["b"], wanted_values={"b": ["a", "b", "c", "d", "e", "f"]}
columns=["b"],
wanted_values={"b": ["a", "b", "c", "d", "e", "f"]},
)

with pytest.warns(None):
with pytest.warns(None) as warnings:
transformer.fit(df)
assert len(warnings) == 0


class TestTransform(
Expand Down Expand Up @@ -501,13 +503,16 @@ def test_transform_output_with_wanted_values_arg(self, library):
)
def test_transform_no_warning_if_all_wanted_values_present(self, library):
"""Test that OneHotEncodingTransformer.transform does NOT raise a warning when all levels in wanted_levels are present in the data."""
df_train = d.create_df_7(library=library)
df_test = d.create_df_8(library=library)
df_train = d.create_df_8(library=library)
df_test = d.create_df_7(library=library)

transformer = OneHotEncodingTransformer(
columns=["b"], wanted_values={"b": ["x", "z", "y"]}
columns=["b"],
wanted_values={"b": ["z", "y", "x"]},
)
transformer.fit(df_train)

with pytest.warns(None):
with pytest.warns(None) as warnings:
transformer.transform(df_test)
assert len(warnings) == 0

Check failure on line 518 in tests/nominal/test_OneHotEncodingTransformer.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (W293)

tests/nominal/test_OneHotEncodingTransformer.py:518:1: W293 Blank line contains whitespace

Check failure on line 518 in tests/nominal/test_OneHotEncodingTransformer.py

View workflow job for this annotation

GitHub Actions / lint (3.9)

Ruff (W292)

tests/nominal/test_OneHotEncodingTransformer.py:518:9: W292 No newline at end of file

0 comments on commit 33534de

Please sign in to comment.