Skip to content

Commit c2279e3

Browse files
author
hauntsaninja
committed
teststubtest: add a test for the previous commit
Also covers some of the MRO logic in verify_typeinfo
1 parent 4d30a84 commit c2279e3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

mypy/test/teststubtest.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,38 @@ def __mangle_bad(self, text): pass
588588
error="X.__mangle_bad"
589589
)
590590

591+
@collect_cases
592+
def test_mro(self) -> Iterator[Case]:
593+
yield Case(
594+
stub="""
595+
class A:
596+
def foo(self, x: int) -> None: ...
597+
class B(A):
598+
pass
599+
class C(A):
600+
pass
601+
""",
602+
runtime="""
603+
class A:
604+
def foo(self, x: int) -> None: ...
605+
class B(A):
606+
def foo(self, x: int) -> None: ...
607+
class C(A):
608+
def foo(self, y: int) -> None: ...
609+
""",
610+
error="C.foo"
611+
)
612+
yield Case(
613+
stub="""
614+
class X: ...
615+
""",
616+
runtime="""
617+
class X:
618+
def __init__(self, x): pass
619+
""",
620+
error="X.__init__"
621+
)
622+
591623

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

0 commit comments

Comments
 (0)