diff --git a/tests/test_eval_call_with_types_signature.py b/tests/test_eval_call_with_types_signature.py new file mode 100644 index 0000000..7c7e5d3 --- /dev/null +++ b/tests/test_eval_call_with_types_signature.py @@ -0,0 +1,15 @@ +from typemap.type_eval import eval_call_with_types + + +def test_eval_call_with_types_accepts_positional_type_objects() -> None: + def func[T](value: T) -> T: + raise NotImplementedError + + assert eval_call_with_types(func, int) is int + + +def test_eval_call_with_types_accepts_keyword_type_objects() -> None: + def func[T](*, value: T) -> T: + raise NotImplementedError + + assert eval_call_with_types(func, value=str) is str diff --git a/typemap/type_eval/_eval_call.py b/typemap/type_eval/_eval_call.py index 570041d..f950386 100644 --- a/typemap/type_eval/_eval_call.py +++ b/typemap/type_eval/_eval_call.py @@ -144,9 +144,9 @@ def _update_bound_typevar( def eval_call_with_types( - func: types.FunctionType | typing.Callable, - *arg_types: tuple[RtType, ...], - **kwarg_types: dict[str, RtType], + func: types.FunctionType | typing.Callable[..., Any], + *arg_types: RtType, + **kwarg_types: RtType, ) -> RtType: if isinstance(func, types.FunctionType): vars: dict[str, Any] = _get_bound_type_args(