From 17b4f7b70f8332da61f3805fa4be7134ebc49245 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Thu, 25 Aug 2022 03:15:50 +0100 Subject: [PATCH] Add test cases for method property overrides --- test-data/unit/check-classes.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test-data/unit/check-classes.test b/test-data/unit/check-classes.test index 20a0c4ae80ea..317cdfdb9908 100644 --- a/test-data/unit/check-classes.test +++ b/test-data/unit/check-classes.test @@ -7457,3 +7457,23 @@ class Bar(Foo): @x.setter def x(self, value: int) -> None: ... [builtins fixtures/property.pyi] + +[case testOverrideMethodProperty] +class B: + def foo(self) -> int: + ... +class C(B): + @property + def foo(self) -> int: # E: Signature of "foo" incompatible with supertype "B" + ... +[builtins fixtures/property.pyi] + +[case testOverridePropertyMethod] +class B: + @property + def foo(self) -> int: + ... +class C(B): + def foo(self) -> int: # E: Signature of "foo" incompatible with supertype "B" + ... +[builtins fixtures/property.pyi]