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

Generic Tests for CappingTransformer #200

Merged
merged 4 commits into from
Apr 15, 2024
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
27 changes: 0 additions & 27 deletions tests/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,33 +113,6 @@ def test_columns_non_string_or_list_error(
uninitialized_transformers[self.transformer_name](**args)


class ColumnsFromDictInitTests(GenericInitTests):
"""
Tests for BaseTransformer.init() behaviour specific to when a transformer reads columns from a dict.
Note this deliberately avoids starting with "Tests" so that the tests are not run on import.
"""

@pytest.mark.parametrize("non_string", [1, True, None])
def test_columns_list_element_error(
self,
non_string,
minimal_attribute_dict,
uninitialized_transformers,
):
"""Test an error is raised if columns list contains non-string elements."""

args = minimal_attribute_dict[self.transformer_name].copy()
args["mappings"][non_string] = {1: 2, 3: 4}

with pytest.raises(
TypeError,
match=re.escape(
f"{self.transformer_name}: each element of columns should be a single (string) column name",
),
):
uninitialized_transformers[self.transformer_name](**args)


class GenericFitTests:
"""
Generic tests for transformer.fit().
Expand Down
Loading
Loading