diff options
author | Devaev Maxim <[email protected]> | 2020-09-09 07:13:34 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-09 07:13:34 +0300 |
commit | de6a66e08e9dbdb4f9896c0ed8f4b43435636df3 (patch) | |
tree | 12910f0e5f63ae209f0aa899fd76cf9e51e93ae5 /testenv/tests | |
parent | 3dfdab787a9d28951501e73653bf33b0b3259ef8 (diff) |
valid_ugpio_driver() fix + tests
Diffstat (limited to 'testenv/tests')
-rw-r--r-- | testenv/tests/validators/test_kvm.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testenv/tests/validators/test_kvm.py b/testenv/tests/validators/test_kvm.py index 27bc1d67..8e9029ab 100644 --- a/testenv/tests/validators/test_kvm.py +++ b/testenv/tests/validators/test_kvm.py @@ -238,6 +238,20 @@ def test_fail__valid_ugpio_item(validator: Callable[[Any], str], arg: Any) -> No # ===== [email protected]("arg", ["foo", " bar", " baz "]) +def test_ok__valid_ugpio_driver_variants(arg: Any) -> None: + value = valid_ugpio_driver(arg, set(["foo", "bar", "baz"])) + assert type(value) == str # pylint: disable=unidiomatic-typecheck + assert value == str(arg).strip() + + [email protected]("arg", ["BAR", " ", "", None]) +def test_fail__valid_ugpio_driver_variants(arg: Any) -> None: + with pytest.raises(ValidatorError): + print(valid_ugpio_driver(arg, set(["foo", "bar", "baz"]))) + + +# ===== @pytest.mark.parametrize("arg", ["Input ", " OUTPUT "]) def test_ok__valid_ugpio_mode(arg: Any) -> None: assert valid_ugpio_mode(arg) == arg.strip().lower() |