diff --git a/mypy/test/teststubtest.py b/mypy/test/teststubtest.py index 34be30d43627..fe7c67261ded 100644 --- a/mypy/test/teststubtest.py +++ b/mypy/test/teststubtest.py @@ -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!