-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for evaluating the
slice
class type arguments for sli…
- Loading branch information
Showing
3 changed files
with
46 additions
and
9 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 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,10 @@ | ||
# This sample tests the evaluation of slice types. | ||
|
||
class ClassA: | ||
def __getitem__[T](self, item: T) -> T: | ||
return item | ||
a1 = ClassA() | ||
|
||
reveal_type(a1[::], expected_text="slice[None, None, None]") | ||
reveal_type(a1[1:'a':False], expected_text="slice[Literal[1], Literal['a'], Literal[False]]") | ||
reveal_type(a1[:3:5.0], expected_text="slice[None, Literal[3], float]") |
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