Repository navigation
Cover common isinstance calling patterns with some overloads
#15954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
89d7aca
2007e47
ad623ad
9e44809
c8d3dba
748f3b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from typing import Any, cast | ||
| from typing_extensions import TypeIs, assert_type | ||
|
|
||
| o = cast(Any, "") | ||
| assert_type(isinstance(o, int), TypeIs[int]) | ||
| assert_type(isinstance(o, object), TypeIs[object]) | ||
| assert_type(isinstance(o, str), TypeIs[str]) | ||
| assert_type(isinstance(o, (bytes, memoryview)), TypeIs[bytes | memoryview[int]]) | ||
|
Check failure on line 8 in stdlib/@tests/test_cases/builtins/check_isinstance.py
|
||
| assert_type(isinstance(o, (set, type[dict])), TypeIs[set[Any] | type[dict[Any, Any]]]) | ||
|
Check failure on line 9 in stdlib/@tests/test_cases/builtins/check_isinstance.py
|
||
Uh oh!
There was an error while loading. Please reload this page.