Closed tclose closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 83.52%. Comparing base (
1720ba6
) to head (27e7fb8
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
NB: rebased on master to pick up new slurm test
i've restarted the failing slurm test, perhaps we should extend some time in GA
That last commit seems to have broken things.
=================================== FAILURES ===================================
___________________________ test_type_check_nested7 ____________________________
[gw0] linux -- Python 3.12.2 /opt/hostedtoolcache/Python/3.12.2/x64/bin/python
def test_type_check_nested7():
> with pytest.raises(TypeError, match="Wrong number of type arguments"):
E Failed: DID NOT RAISE <class 'TypeError'>
/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/pydra/utils/tests/test_typing.py:159: Failed
_______________________ test_matches_type_tuple_ellipsis _______________________
[gw0] linux -- Python 3.12.2 /opt/hostedtoolcache/Python/3.12.2/x64/bin/python
def test_matches_type_tuple_ellipsis():
assert TypeParser.matches_type(ty.Tuple[int], ty.Tuple[int, ...])
assert TypeParser.matches_type(ty.Tuple[int, int], ty.Tuple[int, ...])
assert not TypeParser.matches_type(ty.Tuple[int, float], ty.Tuple[int, ...])
> assert not TypeParser.matches_type(ty.Tuple[int, ...], ty.Tuple[int])
E AssertionError: assert not True
E + where True = <bound method TypeParser.matches_type of <class 'pydra.utils.typing.TypeParser'>>(typing.Tuple[int, ...], typing.Tuple[int])
E + where <bound method TypeParser.matches_type of <class 'pydra.utils.typing.TypeParser'>> = TypeParser.matches_type
/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/pydra/utils/tests/test_typing.py:513: AssertionError
That last commit seems to have broken things.
=================================== FAILURES =================================== ___________________________ test_type_check_nested7 ____________________________ [gw0] linux -- Python 3.12.2 /opt/hostedtoolcache/Python/3.12.2/x64/bin/python def test_type_check_nested7(): > with pytest.raises(TypeError, match="Wrong number of type arguments"): E Failed: DID NOT RAISE <class 'TypeError'> /opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/pydra/utils/tests/test_typing.py:159: Failed _______________________ test_matches_type_tuple_ellipsis _______________________ [gw0] linux -- Python 3.12.2 /opt/hostedtoolcache/Python/3.12.2/x64/bin/python def test_matches_type_tuple_ellipsis(): assert TypeParser.matches_type(ty.Tuple[int], ty.Tuple[int, ...]) assert TypeParser.matches_type(ty.Tuple[int, int], ty.Tuple[int, ...]) assert not TypeParser.matches_type(ty.Tuple[int, float], ty.Tuple[int, ...]) > assert not TypeParser.matches_type(ty.Tuple[int, ...], ty.Tuple[int]) E AssertionError: assert not True E + where True = <bound method TypeParser.matches_type of <class 'pydra.utils.typing.TypeParser'>>(typing.Tuple[int, ...], typing.Tuple[int]) E + where <bound method TypeParser.matches_type of <class 'pydra.utils.typing.TypeParser'>> = TypeParser.matches_type /opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/pydra/utils/tests/test_typing.py:513: AssertionError
This is a bit tricky as I can't quite remember what my desired logic was. However, I have decided the tests failed because they were too strict instead of a bug in the code. Basicially, it comes down to whether
tuple[int, ...]
should match a target type of tuple[int]
(in test_matches_type_tuple_ellipsis4) and likewise
list[int]
be able to be coerced into tuple[float, float, float]
Given the philosophy of permissive typing at construction time, i.e. if it could be ok, don't raise an error just because it isn't guaranteed to be (error will be raised at runtime if it is a problem), I think both these cases are ok and therefore I have relaxed the tests accordingly
Types of changes
Summary
Relaxes typing of lazy fields to allow super-classes to be passed to sub-class fields. Implements #682
Checklist