Skip to content

Commit 8bb25fa

Browse files
committed
And a test
1 parent 0aaa011 commit 8bb25fa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2675,9 +2675,21 @@ class A(tuple[Unpack[tuple[int]]]): ...
26752675
class B(tuple[Unpack[tuple[()]]]): ...
26762676

26772677
a: A
2678-
tuple(a)
2678+
reveal_type(tuple(a)) # N: Revealed type is "builtins.tuple[builtins.int, ...]"
26792679
(x,) = a
26802680

26812681
b: B
26822682
(_,) = b # E: Need more than 0 values to unpack (1 expected)
26832683
[builtins fixtures/tuple.pyi]
2684+
2685+
[case testNoCrashSubclassingTupleWithVariadicUnpack]
2686+
# https://github.com/python/mypy/issues/19105
2687+
from typing import Unpack
2688+
2689+
class A(tuple[Unpack[tuple[int, ...]]]): ...
2690+
2691+
a: A
2692+
tuple(a)
2693+
(x,) = a
2694+
(_,) = a
2695+
[builtins fixtures/tuple.pyi]

0 commit comments

Comments
 (0)