diff --git a/test-data/unit/check-expressions.test b/test-data/unit/check-expressions.test index d5ddc910bcd6..0791762759b9 100644 --- a/test-data/unit/check-expressions.test +++ b/test-data/unit/check-expressions.test @@ -1144,6 +1144,36 @@ f() and b # E: "f" does not return a value (it only ever returns None) b or f() # E: "f" does not return a value (it only ever returns None) [builtins fixtures/bool.pyi] +[case testNoneReturnWithDecorators-xfail] +# See: https://github.com/python/mypy/issues/14179 +from typing import Callable, TypeVar + +F = TypeVar('F', bound=Callable) + +def deco(f: F) -> F: + pass + +@deco +@deco +def f() -> None: + pass + +y1 = f() # E: "f" does not return a value (it only ever returns None) + +class A: + @staticmethod + def g() -> None: pass + +y2 = A.g() # E: "g" of "A" does not return a value (it only ever returns None) +y3 = A().g() # E: "g" of "A" does not return a value (it only ever returns None) +[builtins fixtures/staticmethod.pyi] + +[case testNoneReturnWithCallable-xfail] +class A: + def __call__(self) -> None: pass + +y = A()() # E: Function does not return a value (it only ever returns None) + -- Slicing -- -------