Skip to content

Commit

Permalink
teststubtest: add a test for the previous commit
Browse files Browse the repository at this point in the history
Also covers some of the MRO logic in verify_typeinfo
  • Loading branch information
hauntsaninja committed May 26, 2020
1 parent 573ac89 commit c44e00a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions mypy/test/teststubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,38 @@ def __mangle_bad(self, text): pass
error="X.__mangle_bad"
)

@collect_cases
def test_mro(self) -> Iterator[Case]:
yield Case(
stub="""
class A:
def foo(self, x: int) -> None: ...
class B(A):
pass
class C(A):
pass
""",
runtime="""
class A:
def foo(self, x: int) -> None: ...
class B(A):
def foo(self, x: int) -> None: ...
class C(A):
def foo(self, y: int) -> None: ...
""",
error="C.foo"
)
yield Case(
stub="""
class X: ...
""",
runtime="""
class X:
def __init__(self, x): pass
""",
error="X.__init__"
)


def remove_color_code(s: str) -> str:
return re.sub("\\x1b.*?m", "", s) # this works!
Expand Down

0 comments on commit c44e00a

Please sign in to comment.