Exemplo n.º 1
0
def test_error_if_df_contains_negative_values(df_vartypes):
    # test error when data contains negative values
    df_neg = df_vartypes.copy()
    df_neg.loc[1, "Age"] = -1

    # test case 4: when variable contains negative value, fit
    with pytest.raises(ValueError):
        transformer = BoxCoxTransformer()
        transformer.fit(df_neg)

    # test case 5: when variable contains negative value, transform
    with pytest.raises(ValueError):
        transformer = BoxCoxTransformer()
        transformer.fit(df_vartypes)
        transformer.transform(df_neg)
Exemplo n.º 2
0
def test_non_fitted_error(df_vartypes):
    with pytest.raises(NotFittedError):
        transformer = BoxCoxTransformer()
        transformer.transform(df_vartypes)
Exemplo n.º 3
0
def test_transform_raises_error_if_df_contains_na(df_vartypes, df_na):
    # test case 3: when dataset contains na, transform method
    with pytest.raises(ValueError):
        transformer = BoxCoxTransformer()
        transformer.fit(df_vartypes)
        transformer.transform(df_na[["Name", "City", "Age", "Marks", "dob"]])