Skip to content

Commit 8eafaba

Browse files
Add TypeIs test
1 parent 48ed840 commit 8eafaba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test-data/unit/check-typeguard.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,15 @@ class E:
740740
def __call__(self, o: object) -> TypeGuard[int]:
741741
return True
742742
x = object()
743+
if E()(x):
744+
reveal_type(x) # N: Revealed type is "builtins.int"
745+
[case testNoCrashOnDunderCallTypeIsTemporaryObject]
746+
from typing_extensions import TypeIs
747+
class E:
748+
def __init__(self) -> None: ...
749+
def __call__(self, o: object) -> TypeIs[int]:
750+
return True
751+
x = object()
743752
if E()(x):
744753
reveal_type(x) # N: Revealed type is "builtins.int"
745754
[builtins fixtures/tuple.pyi]

0 commit comments

Comments
 (0)