Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/test_eval_call_with_types_signature.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions typemap/type_eval/_eval_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down