Skip to content

Commit ae0422a

Browse files
tcloseeffigies
andauthored
Update pydra/utils/tests/test_typing.py
Co-authored-by: Chris Markiewicz <[email protected]>
1 parent ca0833c commit ae0422a

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

pydra/utils/tests/test_typing.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,28 +1039,19 @@ def test_type_is_instance11a():
10391039
assert not TypeParser.is_instance(None, int | str)
10401040

10411041

1042-
def test_multi_input_obj_coerce1():
1043-
assert TypeParser(MultiInputObj[str])("a") == ["a"]
1044-
1045-
1046-
def test_multi_input_obj_coerce2():
1047-
assert TypeParser(MultiInputObj[str])(["a"]) == ["a"]
1048-
1049-
1050-
def test_multi_input_obj_coerce3():
1051-
assert TypeParser(MultiInputObj[ty.List[str]])(["a"]) == [["a"]]
1052-
1053-
1054-
def test_multi_input_obj_coerce3a():
1055-
assert TypeParser(MultiInputObj[ty.Union[int, ty.List[str]]])(["a"]) == [["a"]]
1056-
1057-
1058-
def test_multi_input_obj_coerce3b():
1059-
assert TypeParser(MultiInputObj[ty.Union[int, ty.List[str]]])([["a"]]) == [["a"]]
1060-
1061-
1062-
def test_multi_input_obj_coerce4():
1063-
assert TypeParser(MultiInputObj[ty.Union[int, ty.List[str]]])([1]) == [1]
1042+
@pytest.mark.parametrize(
1043+
("typ", "obj", "result"),
1044+
[
1045+
(MultiInputObj[str], "a", ["a"]),
1046+
(MultiInputObj[str], ["a"], ["a"]),
1047+
(MultiInputObj[ty.List[str]], ["a"], [["a"]]),
1048+
(MultiInputObj[ty.Union[int, ty.List[str]]], ["a"], [["a"]]),
1049+
(MultiInputObj[ty.Union[int, ty.List[str]]], [["a"]], [["a"]]),
1050+
(MultiInputObj[ty.Union[int, ty.List[str]]], [1], [1]),
1051+
]
1052+
)
1053+
def test_multi_input_obj_coerce(typ, obj, result):
1054+
assert TypeParser(typ)(obj) == result
10641055

10651056

10661057
def test_multi_input_obj_coerce4a():

0 commit comments

Comments
 (0)