Skip to content

Commit 536ffd8

Browse files
committed
Add extra tests for empty TypeVarTuples
1 parent 88e3871 commit 536ffd8

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

test-data/unit/check-generics.test

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3624,9 +3624,31 @@ t2.foo = [1] # E: Value of type variable "T" of "foo" of "Test" cannot be "int"
36243624
[builtins fixtures/property.pyi]
36253625

36263626
[case testMissingTypeArgsInApplication]
3627-
x: list[()] = [] # E: "list" expects 1 type argument, but none given
3627+
from typing import Generic
3628+
from typing_extensions import Unpack, TypeVarTuple
3629+
3630+
Ts = TypeVarTuple("Ts")
3631+
3632+
class CanHaveZero(Generic[Unpack[Ts]]): ...
3633+
3634+
ok1: CanHaveZero[()]
3635+
ok2: tuple[()]
3636+
3637+
bad1: list[()] = [] # E: "list" expects 1 type argument, but none given
3638+
[builtins fixtures/tuple.pyi]
36283639

36293640
[case testMissingTypeArgsInApplicationStrict]
36303641
# flags: --strict
3631-
x: list[()] = [] # E: "list" expects 1 type argument, but none given \
3632-
# E: Missing type arguments for generic type "list"
3642+
from typing import Generic
3643+
from typing_extensions import Unpack, TypeVarTuple
3644+
3645+
Ts = TypeVarTuple("Ts")
3646+
3647+
class CanHaveZero(Generic[Unpack[Ts]]): ...
3648+
3649+
ok1: CanHaveZero[()]
3650+
ok2: tuple[()]
3651+
3652+
bad1: list[()] = [] # E: "list" expects 1 type argument, but none given \
3653+
# E: Missing type arguments for generic type "list"
3654+
[builtins fixtures/tuple.pyi]

0 commit comments

Comments
 (0)