def test_user_enters_variables_and_max_value_imputation(df_na):
    imputer = EndTailImputer(imputation_method="max",
                             tail="right",
                             fold=2,
                             variables=["Age", "Marks"])
    imputer.fit(df_na)
    assert imputer.imputer_dict_ == {"Age": 82.0, "Marks": 1.8}
def test_user_enters_variables_and_iqr_imputation_on_left_tail(df_na):
    # test case 5: IQR + left tail
    imputer = EndTailImputer(imputation_method="iqr",
                             tail="left",
                             fold=1.5,
                             variables=["Age", "Marks"])
    imputer.fit(df_na)
    assert imputer.imputer_dict_ == {"Age": -6.5, "Marks": 0.36249999999999993}
def test_automatically_select_variables_and_gaussian_imputation_on_left_tail(
        df_na):
    imputer = EndTailImputer(imputation_method="gaussian", tail="left", fold=3)
    imputer.fit(df_na)
    assert imputer.imputer_dict_ == {
        "Age": -1.520509756212462,
        "Marks": 0.04224051634034898,
    }
def test_automatically_select_variables_and_gaussian_imputation_on_left_tail(
        df_na):
    imputer = EndTailImputer(imputation_method="gaussian", tail="left", fold=3)
    imputer.fit(df_na)
    imputer.imputer_dict_ = {
        key: round(value, 3)
        for (key, value) in imputer.imputer_dict_.items()
    }
    assert imputer.imputer_dict_ == {
        "Age": -1.521,
        "Marks": 0.042,
    }