Skip to content

Commit

Permalink
Merge 5de7f20 into 6945ee0
Browse files Browse the repository at this point in the history
  • Loading branch information
kedder committed Feb 10, 2023
2 parents 6945ee0 + 5de7f20 commit 76a6af7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/samples/isinstance_impl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from typing import Optional
from zope.interface import implementer, Interface


class IFoo(Interface):
...


@implementer(IFoo)
class MyFoo:
...


def make_foo() -> Optional[IFoo]:
return MyFoo()


x = make_foo()
reveal_type(x)
assert isinstance(x, MyFoo)

# The code below should not be considered unreachable
print("hello")

"""
<output>
isinstance_impl.py:19: note: Revealed type is "Union[__main__.IFoo, None]"
</output>
"""

0 comments on commit 76a6af7

Please sign in to comment.