Example #1
0
def test_renamer_returns_correctly(numerical):
    new_col_names = ['test_a', 'test_b']
    renamer = Renamer(new_col_names)
    result = renamer.fit_transform(numerical)

    assert isinstance(result, pd.DataFrame)
    assert len(numerical) == len(result)
    assert set(new_col_names) == set(result.columns)
Example #2
0
def test_renamer_works_correctly_if_only_given_string(numerical):
    single_column = numerical.iloc[:, 1].to_frame()
    renamer = Renamer('test')
    result = renamer.fit_transform(single_column)

    assert isinstance(result, pd.DataFrame)
    assert ['test'] == result.columns
    assert len(numerical) == len(result)
Example #3
0
def test_mismatched_no_of_names_raises(numerical):
    new_col_names = ['test_a']
    renamer = Renamer(new_col_names)
    with pytest.raises(TransformerError):
        renamer.fit_transform(numerical)
 def test_mismatched_no_of_names_raises(self, numerical: pd.DataFrame):
     new_col_names = ["test_a"]
     renamer = Renamer(new_col_names)
     with pytest.raises(TransformerError):
         renamer.fit_transform(numerical)