Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 1, 2026
commit 62fc87b976f3a53168c89574fabb188aced563b1
18 changes: 9 additions & 9 deletions test-data/unit/check-tuples.test
Original file line number Diff line number Diff line change
Expand Up @@ -1593,27 +1593,27 @@ from typing import Tuple
t: Tuple[int, ...] = (1, 2, 3, 4, 5, 6, 7, 8, "str", "str", "str", 11) # E: Incompatible types in assignment (3 tuple items are incompatible) \
# N: Expression tuple item 8 has type "str"; "int" expected; \
# N: Expression tuple item 9 has type "str"; "int" expected; \
# N: Expression tuple item 10 has type "str"; "int" expected;
# N: Expression tuple item 10 has type "str"; "int" expected;

# long initializer assignment with more mismatches
t1: Tuple[int, ...] = (1, 2, 3, 4, 5, 6, 7, 8, "str", "str", "str", "str") # E: Incompatible types in assignment (4 tuple items are incompatible; 1 items are omitted) \
# N: Expression tuple item 8 has type "str"; "int" expected; \
# N: Expression tuple item 9 has type "str"; "int" expected; \
# N: Expression tuple item 10 has type "str"; "int" expected;
# N: Expression tuple item 10 has type "str"; "int" expected;

# short tuple initializer assignment
t2: Tuple[int, ...] = (1, 2, "s", 4) # E: Incompatible types in assignment (expression has type "tuple[int, int, str, int]", variable has type "tuple[int, ...]")

# long initializer assignment with few mismatches, no ellipsis
t3: Tuple[int, int, int, int, int, int, int, int, int, int, int, int] = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, "str", "str") # E: Incompatible types in assignment (2 tuple items are incompatible) \
# N: Expression tuple item 10 has type "str"; "int" expected; \
# N: Expression tuple item 11 has type "str"; "int" expected;
# N: Expression tuple item 11 has type "str"; "int" expected;

# long initializer assignment with more mismatches, no ellipsis
t4: Tuple[int, int, int, int, int, int, int, int, int, int, int, int] = (1, 2, 3, 4, 5, 6, 7, 8, "str", "str", "str", "str") # E: Incompatible types in assignment (4 tuple items are incompatible; 1 items are omitted) \
# N: Expression tuple item 8 has type "str"; "int" expected; \
# N: Expression tuple item 9 has type "str"; "int" expected; \
# N: Expression tuple item 10 has type "str"; "int" expected;
# N: Expression tuple item 10 has type "str"; "int" expected;

# short tuple initializer assignment, no ellipsis
t5: Tuple[int, int] = (1, 2, "s", 4) # E: Incompatible types in assignment (expression has type "tuple[int, int, str, int]", variable has type "tuple[int, int]")
Expand Down Expand Up @@ -1668,9 +1668,9 @@ class A:
)
[out]
main:18: error: Incompatible return value type (6 tuple items are incompatible; 3 items are omitted)
main:18: note: Expression tuple item 6 has type "str | int"; "str" expected;
main:18: note: Expression tuple item 7 has type "str | float"; "str" expected;
main:18: note: Expression tuple item 8 has type "str | None"; "str" expected;
main:18: note: Expression tuple item 6 has type "str | int"; "str" expected;
main:18: note: Expression tuple item 7 has type "str | float"; "str" expected;
main:18: note: Expression tuple item 8 has type "str | None"; "str" expected;
[builtins fixtures/property.pyi]

[case testPropertyLongTupleReturnTypeMismatchUnionWiderExpected]
Expand Down Expand Up @@ -1707,8 +1707,8 @@ class A:
)
[out]
main:18: error: Incompatible return value type (2 tuple items are incompatible)
main:18: note: Expression tuple item 2 has type "str"; "int" expected;
main:18: note: Expression tuple item 11 has type "float | int"; "str" expected;
main:18: note: Expression tuple item 2 has type "str"; "int" expected;
main:18: note: Expression tuple item 11 has type "float | int"; "str" expected;
[builtins fixtures/property.pyi]

[case testTupleWithStarExpr]
Expand Down
Loading