Skip to content

Commit

Permalink
fix up type checking of none-types
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Mar 26, 2024
1 parent a7fbf26 commit 4210554
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions pydra/utils/tests/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,3 @@ def test_type_is_instance10():

def test_type_is_instance11():
assert not TypeParser.is_instance(None, ty.Union[int, str])


def test_type_is_instance12():
assert not TypeParser.is_instance((1, None), ty.Tuple[int, None])
2 changes: 2 additions & 0 deletions pydra/utils/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ def is_subclass(
args = get_args(klass)

for candidate in candidates:
if candidate is None:
candidate = type(None)

Check warning on line 676 in pydra/utils/typing.py

View check run for this annotation

Codecov / codecov/patch

pydra/utils/typing.py#L676

Added line #L676 was not covered by tests
candidate_origin = get_origin(candidate)
candidate_args = get_args(candidate)
# Handle ty.Type[*] types in klass and candidates
Expand Down

0 comments on commit 4210554

Please sign in to comment.