def test_non_pd_df_error(self): """Test an error is raised if X is not passed as a pd.DataFrame.""" x = BaseTransformer(columns="a") with pytest.raises(ValueError): x.columns_check(X=[1, 2, 3, 4, 5, 6])
def test_columns_not_in_X_error(self): """Test an error is raised if self.columns contains a value not in X.""" df = d.create_df_1() x = BaseTransformer(columns=["a", "z"]) with pytest.raises(ValueError): x.columns_check(X=df)
def test_columns_str_error(self): """Test an error is raised if self.columns is not a list.""" df = d.create_df_1() x = BaseTransformer(columns=None) x.columns = "a" with pytest.raises(ValueError): x.columns_check(X=df)
def test_columns_none_error(self): """Test an error is raised if self.columns is None.""" df = d.create_df_1() x = BaseTransformer(columns=None) assert x.columns is None, f"self.columns should be None but got {x.columns}" with pytest.raises(ValueError): x.columns_check(X=df)