Skip to content

Commit 29e77f1

Browse files
committed
test
1 parent 770c5d0 commit 29e77f1

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test-data/unit/check-narrowing.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,15 @@ if type(x) is not int:
30213021
else:
30223022
reveal_type(x) # N: Revealed type is "builtins.int"
30233023

3024+
[case testTypeNarrowingAgainstType]
3025+
# flags: --strict-equality --warn-unreachable
3026+
class A:
3027+
def foo(self, x: object) -> None:
3028+
reveal_type(self) # N: Revealed type is "__main__.A"
3029+
if type(self) is type(x):
3030+
reveal_type(self) # N: Revealed type is "__main__.A"
3031+
reveal_type(x) # N: Revealed type is "__main__.A"
3032+
30243033
[case testNarrowInElseCaseIfFinal]
30253034
# flags: --strict-equality --warn-unreachable
30263035
from typing import final, Union

0 commit comments

Comments
 (0)