Add test which demonstrates incomplete generic Callable handling

This commit is contained in:
Peter Law
2020-04-19 12:50:24 +01:00
parent 7ebbf9da44
commit 2ac806e39f

View File

@@ -80,6 +80,7 @@ for c2, in list_t_to_list_tuple_t(list_of_ints):
c2
# Test handling of nested callables
def foo(x: int) -> int:
return x
@@ -99,6 +100,21 @@ for b in list_func_t_to_list_func_type_t(list_of_funcs):
b(int)
def bar(*a, **k) -> int:
return len(a) + len(k)
list_of_funcs_2 = [bar] # type: List[Callable[..., int]]
def list_func_t_passthrough(the_list: List[Callable[..., T]]) -> List[Callable[..., T]]:
return the_list
for b in list_func_t_passthrough(list_of_funcs_2):
#? int()
b(None, x="x")
mapping_int_str = {42: 'a'} # type: Dict[int, str]
# Test that mappings (that have more than one parameter) are handled