def test_missing_values_param():

    df = {
        "Name": ["tom", "nick", "krish", "jack"],
        "City": ["London", "Manchester", "Liverpool", "Bristol"],
        "Age": [20, 21, 19, 18],
        "Marks": [0.9, 0.8, 0.7, 0.6],
        "dob": pd.date_range("2020-02-24", periods=4, freq="T"),
        "const_feat_num": [1, 1, 1, np.nan],
        "const_feat_cat": ["a", "a", "a", "a"],
        "quasi_feat_num": [1, 1, 1, 2],
        "quasi_feat_cat": ["a", "a", "a", np.nan],
    }
    df = pd.DataFrame(df)

    # test raises error if there is na
    with pytest.raises(ValueError):
        transformer = DropConstantFeatures(missing_values="raise")
        transformer.fit(df)

    # test ignores na
    transformer = DropConstantFeatures(missing_values="ignore").fit(df)
    constant = ["const_feat_num", "const_feat_cat", "quasi_feat_cat"]
    assert transformer.constant_features_ == constant
    pd.testing.assert_frame_equal(df.drop(constant, axis=1),
                                  transformer.transform(df))

    # test includes na
    transformer = DropConstantFeatures(tol=0.7,
                                       missing_values="include").fit(df)
    qconstant = [
        "const_feat_num", "const_feat_cat", "quasi_feat_num", "quasi_feat_cat"
    ]
    assert transformer.constant_features_ == qconstant
    pd.testing.assert_frame_equal(df.drop(qconstant, axis=1),
                                  transformer.transform(df))
def test_non_fitted_error(df_constant_features):
    # test case 8: when fit is not called prior to transform
    with pytest.raises(NotFittedError):
        transformer = DropConstantFeatures()
        transformer.transform(df_constant_features)