mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-96385: Correctly raise error on [*T, *V]
substitution (GH-96386)
This commit is contained in:
parent
d21d2f0793
commit
75177358a6
3 changed files with 7 additions and 1 deletions
|
@ -596,6 +596,7 @@ class GenericAliasSubstitutionTests(BaseTestCase):
|
|||
def test_one_parameter(self):
|
||||
T = TypeVar('T')
|
||||
Ts = TypeVarTuple('Ts')
|
||||
Ts2 = TypeVarTuple('Ts2')
|
||||
|
||||
class C(Generic[T]): pass
|
||||
|
||||
|
@ -621,6 +622,8 @@ class GenericAliasSubstitutionTests(BaseTestCase):
|
|||
# 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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue