def test_one_parameter(self):
T = TypeVar('T')
Ts = TypeVarTuple('Ts')
+ Ts2 = TypeVarTuple('Ts2')
class C(Generic[T]): pass
# Should definitely raise TypeError: list only takes one argument.
('list[T, *tuple_type[int, ...]]', '[int]', 'list[int, *tuple_type[int, ...]]'),
('List[T, *tuple_type[int, ...]]', '[int]', 'TypeError'),
+ # Should raise, because more than one `TypeVarTuple` is not supported.
+ ('generic[*Ts, *Ts2]', '[int]', 'TypeError'),
]
for alias_template, args_template, expected_template in tests:
def __typing_prepare_subst__(self, alias, args):
params = alias.__parameters__
typevartuple_index = params.index(self)
- for param in enumerate(params[typevartuple_index + 1:]):
+ for param in params[typevartuple_index + 1:]:
if isinstance(param, TypeVarTuple):
raise TypeError(f"More than one TypeVarTuple parameter in {alias}")