Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix broken test for Mapping transformer #176

Merged
merged 1 commit into from
Feb 5, 2024
Merged
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
19 changes: 7 additions & 12 deletions tests/mapping/test_MappingTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,26 +234,21 @@ def test_unexpected_dtype_change_warning_raised(
):
x.transform(df)

@pytest.mark.parametrize(
("mapping", "input_col_name", "input_col_type"),
[
({"a": {1: True, 6: False}}, "a", "int64"),
],
)
def test_unexpected_dtype_change_warning_suppressed(
self,
mapping,
input_col_name,
input_col_type,
recwarn,
):
df = d.create_df_1()

mapping = {"a": {1: True, 6: False}}

x = MappingTransformer(mappings=mapping)

with pytest.warns(None) as warnings_record:
x.transform(df, suppress_dtype_warning=True)
x.transform(df, suppress_dtype_warning=True)

assert len(warnings_record) == 0
assert (
len(recwarn) == 0
), "MappingTransformer: warning raised for dtype change with supress_dtype_warning=True"

def test_category_dtype_is_conserved(self):
"""This is a separate test due to the behaviour of category dtypes.
Expand Down
Loading