Exemplo n.º 1
0
def test_validate_integer_valid_inclusive():
    validate_integer(
        "arg",
        10,
        min_value=0,
        max_value=20,
        inclusive=True,
        custom_min_message="custom min msg",
        custom_max_message="custom max msg",
    )
Exemplo n.º 2
0
def test_validate_integer_max_std_err_msg_inclusive():
    with pytest.raises(ValueError) as ex:
        validate_integer("arg", 10, min_value=1, max_value=5, inclusive=True)
    assert "arg" in str(ex.value)
    assert "5" in str(ex.value)
Exemplo n.º 3
0
def test_validate_integer_valid_inclusive_equal():
    validate_integer(
        "arg", 10, min_value=10, max_value=20, inclusive=True,
    )
Exemplo n.º 4
0
def test_validate_integer_max_custom_err_msg():
    with pytest.raises(ValueError) as ex:
        validate_integer(
            "arg", 10, min_value=1, max_value=5, custom_max_message="custom"
        )
    assert str(ex.value) == "custom"
Exemplo n.º 5
0
def test_validate_integer_error(object_value, exception):
    with pytest.raises(exception) as ex:
        validate_integer("arg", object_value, min_value=100, inclusive=False)
    assert "arg" in str(ex.value)