def test_fit_and_transform_raise_error_if_df_contains_na(df_normal_dist): df_na = df_normal_dist.copy() df_na.loc[1, "var"] = np.nan # test case 5: when dataset contains na, fit method with pytest.raises(ValueError): transformer = ArbitraryOutlierCapper( min_capping_dict={"var": -0.17486039103044}) transformer.fit(df_na) # test case 6: when dataset contains na, transform method with pytest.raises(ValueError): transformer = ArbitraryOutlierCapper( min_capping_dict={"var": -0.17486039103044}) transformer.fit(df_normal_dist) transformer.transform(df_na)
def test_non_fitted_error(df_vartypes): with pytest.raises(NotFittedError): transformer = ArbitraryOutlierCapper( min_capping_dict={"var": -0.17486039103044}) transformer.transform(df_vartypes)