Example #1
0
def test_named_transform_type_not_found():
    d = yaml.load(
        fixtures.named_not_found_y("plusOne", "plusOne", "plusM"),
        Loader=yaml.FullLoader,
    )
    p = data.Policy(**d)
    tfm = p.rules[0].transformations[0]

    with pytest.raises(exceptions.NamedTransformNotFound) as e:
        policy_lib._get_transformation(p, tfm, pandas_lib.registry,
                                       pandas_lib.dtypes)
    assert str(e.value) == "Could not find transform of type plusM in registry"
Example #2
0
def test_named_transform_not_found():
    pandas_lib.registry.register("plusN", test_utils.PlusN)
    d = yaml.load(
        fixtures.named_not_found_y("plusOne", "plusOneThousand", "plusN"),
        Loader=yaml.FullLoader,
    )

    df = pd.DataFrame(np.ones(5, ), columns=["test"])

    p = data.Policy(**d)
    tfm = p.rules[0].transformations[0]

    with pytest.raises(exceptions.NamedTransformNotFound) as e:
        policy_lib._get_transformation(p, tfm, df, pandas_lib.dtypes)

    assert str(e.value) == (
        "Could not find transform plusOneThousand in transformations block")