From 4210554001244af014eefffd6d96a13100cdf6f6 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 26 Mar 2024 11:59:59 +1100 Subject: [PATCH] fix up type checking of none-types --- pydra/utils/tests/test_typing.py | 4 ---- pydra/utils/typing.py | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pydra/utils/tests/test_typing.py b/pydra/utils/tests/test_typing.py index 1c239554da..d192870733 100644 --- a/pydra/utils/tests/test_typing.py +++ b/pydra/utils/tests/test_typing.py @@ -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]) diff --git a/pydra/utils/typing.py b/pydra/utils/typing.py index a3e441be1d..644b26cf71 100644 --- a/pydra/utils/typing.py +++ b/pydra/utils/typing.py @@ -672,6 +672,8 @@ def is_subclass( args = get_args(klass) for candidate in candidates: + if candidate is None: + candidate = type(None) candidate_origin = get_origin(candidate) candidate_args = get_args(candidate) # Handle ty.Type[*] types in klass and candidates