Esempio n. 1
0
def test_check_value_fail_type(value, val_type):
    try:
        _check_value("TestOp", "test_attr", value, val_type, None)
    except UserInputError:
        pass
    else:
        raise AssertionError("Type validation has unexpectedly passed.")
Esempio n. 2
0
def test_check_value_fail_cond(value, val_type):
    def is_even(x):
        return x % 2 == 0

    try:
        _check_value("TestOp", "test_attr", value, val_type, is_even)
    except UserInputError:
        pass
    else:
        raise AssertionError("Condition validation has unexpectedly passed.")
Esempio n. 3
0
def test_check_value(value, val_type):
    def is_even(x):
        return x % 2 == 0

    assert _check_value("TestOp", "test_attr", value, val_type, is_even)