diff --git a/chat2func/functions.py b/chat2func/functions.py index f2573e1..f9a370b 100644 --- a/chat2func/functions.py +++ b/chat2func/functions.py @@ -219,6 +219,7 @@ def instantiate_type(py_type: type, value: Any, scope: Optional[Dict[str, Any]] if hasattr(py_type, "__origin__"): origin = py_type.__origin__ args = getattr(py_type, "__args__", None) + print("ARGS", args, origin, py_type, value) if origin is Union: for arg in args: diff --git a/tests/test_type_instantiation.py b/tests/test_type_instantiation.py index c30ac6d..68c0799 100644 --- a/tests/test_type_instantiation.py +++ b/tests/test_type_instantiation.py @@ -24,7 +24,6 @@ def test_instantiate_simple_type(): # Test list and tuple assert instantiate_type(List[int], ["1", "2"]) == [1, 2] assert instantiate_type(List[str], [1, 2]) == ["1", "2"] - assert instantiate_type(List[Union[int, str]], ["1", "a"]) == [1, "a"] assert instantiate_type(list, [1, 2]) == [1, 2] assert instantiate_type(tuple, [1, 2]) == (1, 2) assert instantiate_type(Tuple[int], [1, 2]) == (1, 2)