From 10bf4c1024b2e58dc71446e65fa2c547ed563c44 Mon Sep 17 00:00:00 2001 From: Clif Bratcher Date: Sun, 26 May 2024 11:50:58 -0400 Subject: [PATCH] Address coverage --- tests/test_param.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_param.py b/tests/test_param.py index f8d64fd..ce5322f 100644 --- a/tests/test_param.py +++ b/tests/test_param.py @@ -190,3 +190,25 @@ def test_param_boolean_implied_false(): assert p1.required is False assert p1.optional is False assert p1.value is False + + +def test_param_validate_list(): + p1 = Param(name="testparam1", annotation=list[str]) + assert p1.validate(["foo", "bar"]) is True + assert p1.required is True + assert p1.optional is False + + +def test_param_set_value_as_seq_valid(): + p1 = Param(name="testparam1", annotation=list[str]) + p1.set_value_as_seq([123, "bar"]) + assert p1.required is True + assert p1.optional is False + + +def test_param_set_value_as_seq_invalid(): + p1 = Param(name="testparam1", annotation=list[int]) + with pytest.raises(ValueError, match="int"): + p1.set_value_as_seq([123, "bar"]) + assert p1.required is True + assert p1.optional is False