diff options
Diffstat (limited to 'testenv')
-rw-r--r-- | testenv/tests/validators/test_basic.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testenv/tests/validators/test_basic.py b/testenv/tests/validators/test_basic.py index 15964a54..85a84d5d 100644 --- a/testenv/tests/validators/test_basic.py +++ b/testenv/tests/validators/test_basic.py @@ -28,6 +28,7 @@ import pytest from kvmd.validators import ValidatorError from kvmd.validators.basic import valid_bool from kvmd.validators.basic import valid_number +from kvmd.validators.basic import valid_int_f0 from kvmd.validators.basic import valid_int_f1 from kvmd.validators.basic import valid_float_f0 from kvmd.validators.basic import valid_float_f01 @@ -83,6 +84,20 @@ def test_fail__valid_number__min_max(arg: Any) -> None: # pylint: disable=inval # ===== [email protected]("arg", [0, 1, 5, "5 "]) +def test_ok__valid_int_f0(arg: Any) -> None: + value = valid_int_f0(arg) + assert type(value) == int # pylint: disable=unidiomatic-typecheck + assert value == int(str(arg).strip()) + + [email protected]("arg", ["test", "", None, -6, "-6 ", "5.0"]) +def test_fail__valid_int_f0(arg: Any) -> None: + with pytest.raises(ValidatorError): + print(valid_int_f0(arg)) + + +# ===== @pytest.mark.parametrize("arg", [1, 5, "5 "]) def test_ok__valid_int_f1(arg: Any) -> None: value = valid_int_f1(arg) |