-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test cases for new "tuples" chapter. (#1609)
* Added test cases for new "tuples" chapter. * Fixed a bug in the tests and test results. Added a few missing tests.
- Loading branch information
Showing
31 changed files
with
628 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
conformant = "Partial" | ||
notes = """ | ||
Does not support tuple narrowing based on `len()` type guard (optional). | ||
Incorrectly narrows tuple based on sequence patterns. | ||
""" | ||
output = """ | ||
tuples_type_compat.py:15: error: Incompatible types in assignment (expression has type "tuple[float, complex]", variable has type "tuple[int, int]") [assignment] | ||
tuples_type_compat.py:29: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int, *tuple[int, ...]]") [assignment] | ||
tuples_type_compat.py:32: error: Incompatible types in assignment (expression has type "tuple[int, *tuple[int, ...]]", variable has type "tuple[int]") [assignment] | ||
tuples_type_compat.py:33: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int]") [assignment] | ||
tuples_type_compat.py:43: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int]") [assignment] | ||
tuples_type_compat.py:62: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int, int]") [assignment] | ||
tuples_type_compat.py:95: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int]" [assert-type] | ||
tuples_type_compat.py:99: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[str, str] | tuple[int, int]" [assert-type] | ||
tuples_type_compat.py:103: error: Expression is of type "tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]", not "tuple[int, str, int]" [assert-type] | ||
tuples_type_compat.py:117: error: Expression is of type "tuple[Never, int]", not "tuple[int | str, int]" [assert-type] | ||
tuples_type_compat.py:136: error: Expression is of type "Sequence[object]", not "Sequence[complex | list[int]]" [assert-type] | ||
tuples_type_compat.py:139: error: Expression is of type "Sequence[object]", not "Sequence[int | str]" [assert-type] | ||
tuples_type_compat.py:144: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, str]") [assignment] | ||
tuples_type_compat.py:149: error: Incompatible types in assignment (expression has type "tuple[int, int, str]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] | ||
tuples_type_compat.py:150: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] | ||
tuples_type_compat.py:156: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] | ||
tuples_type_compat.py:157: error: Incompatible types in assignment (expression has type "tuple[int, str, str, float]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] | ||
tuples_type_compat.py:162: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[*tuple[str, ...], int]") [assignment] | ||
tuples_type_compat.py:163: error: Incompatible types in assignment (expression has type "tuple[str, str, float]", variable has type "tuple[*tuple[str, ...], int]") [assignment] | ||
tuples_type_compat.py:168: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, int]") [assignment] | ||
tuples_type_compat.py:171: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, str, *tuple[str, ...]]") [assignment] | ||
tuples_type_compat.py:175: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[*tuple[str, ...], str, str, str]") [assignment] | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
conformant = "Pass" | ||
output = """ | ||
tuples_type_form.py:12: error: Incompatible types in assignment (expression has type "tuple[int, int]", variable has type "tuple[int]") [assignment] | ||
tuples_type_form.py:14: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "tuple[int, int]") [assignment] | ||
tuples_type_form.py:15: error: Incompatible types in assignment (expression has type "tuple[int, str]", variable has type "tuple[int, int]") [assignment] | ||
tuples_type_form.py:25: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "tuple[()]") [assignment] | ||
tuples_type_form.py:36: error: Incompatible types in assignment (expression has type "tuple[int, int, int, str]", variable has type "tuple[int, ...]") [assignment] | ||
tuples_type_form.py:40: error: Unexpected "..." [misc] | ||
tuples_type_form.py:41: error: Unexpected "..." [misc] | ||
tuples_type_form.py:42: error: Unexpected "..." [misc] | ||
tuples_type_form.py:43: error: Unexpected "..." [misc] | ||
tuples_type_form.py:44: error: Unpack is only valid in a variadic position [valid-type] | ||
tuples_type_form.py:45: error: Unpack is only valid in a variadic position [valid-type] | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
conformant = "Partial" | ||
notes = """ | ||
"More than one unpack" error is missing a line number. | ||
""" | ||
output = """ | ||
tuples_unpacked.py: error: More than one Unpack in a type is not allowed [misc] | ||
tuples_unpacked.py:58: error: More than one Unpack in a type is not allowed [misc] | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.