Skip to content

Commit f37f381

Browse files
committed
Refactor test to work with python 3.10/3.11, and 3.12+
1 parent d69a129 commit f37f381

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

test-data/unit/check-typevar-tuple.test

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2756,18 +2756,21 @@ def c(t: X[Concatenate[int, ...]]) -> None: # E: Cannot use "[int, VarArg(Any),
27562756
[builtins fixtures/tuple.pyi]
27572757

27582758
[case testTypeVarTupleLiteralValueAsTypeArgument]
2759-
# flags: --python-version 3.12
2760-
from typing import TypeVarTuple, Generic, Unpack
2759+
from typing import TypeVarTuple, Generic, Unpack, Callable, TypeVar
27612760

27622761
Ts = TypeVarTuple('Ts')
2762+
T = TypeVar('T')
27632763

2764-
def fn[*T]() -> None:
2765-
pass
2766-
2767-
class C(Generic[*Ts]):
2764+
class C(Generic[Unpack[Ts]]):
27682765
pass
27692766

27702767
x = C[1, 2, 3]() # E: Invalid type: try using Literal[1] instead? \
27712768
# E: Invalid type: try using Literal[2] instead? \
27722769
# E: Invalid type: try using Literal[3] instead?
2770+
2771+
def func(d: Callable[[Unpack[Ts]], T]) -> T: ...
2772+
2773+
y = func[1, int] # E: Type application is only supported for generic classes \
2774+
# E: Invalid type argument: type expected, for Any \
2775+
# E: Invalid type: try using Literal[1] instead?
27732776
[builtins fixtures/tuple.pyi]

0 commit comments

Comments
 (0)