Generics don't have signatures

This commit is contained in:
Dave Halter
2021-01-01 04:09:49 +01:00
parent 778442a972
commit 30e702de11
2 changed files with 7 additions and 1 deletions

View File

@@ -146,6 +146,9 @@ class DefineGenericBaseClass(LazyValueWrapper):
) for class_set1, class_set2 in zip(given_params1, given_params2)
)
def get_signatures(self):
return []
def __repr__(self):
return '<%s: %s%s>' % (
self.__class__.__name__,

View File

@@ -114,6 +114,9 @@ class X:
'TypeVar(name: str, *constraints: Type[Any], bound: Union[None, Type[Any], str]=..., '
'covariant: bool=..., contravariant: bool=...)'),
('from typing import List\nList(', None),
('from typing import List\nList[int](', None),
('from typing import Tuple\nTuple(', None),
('from typing import Tuple\nTuple[int](', None),
]
)
def test_tree_signature(Script, environment, code, expected):
@@ -148,7 +151,7 @@ def test_tree_signature(Script, environment, code, expected):
('full_redirect(C)', 'z, *, c'),
('full_redirect(C())', 'y'),
('full_redirect(G)', 't: T'),
('full_redirect(G[str])', 't: T'),
('full_redirect(G[str])', '*args, **kwargs'),
('D', 'D(a, z, /)'),
('D()', 'D(x, y)'),
('D().foo', 'foo(a, *, bar, z, **kwargs)'),