Skip to content

Commit 3eb7e2a

Browse files
committed
Reorder new tests
1 parent a60c4d2 commit 3eb7e2a

File tree

1 file changed

+34
-55
lines changed

1 file changed

+34
-55
lines changed

test-data/unit/check-classes.test

+34-55
Original file line numberDiff line numberDiff line change
@@ -147,48 +147,6 @@ class Base:
147147
class Derived(Base):
148148
__hash__ = 1 # E: Incompatible types in assignment (expression has type "int", base class "Base" defined the type as "Callable[[Base], int]")
149149

150-
[case testOverrideCallableAttributeWithMethod]
151-
from typing import Callable
152-
153-
class Base:
154-
func1: Callable[[str], str]
155-
func2: Callable[[str], str]
156-
func3: Callable[[str], str]
157-
158-
class Derived(Base):
159-
def func1(self, x: str) -> str:
160-
pass
161-
162-
@classmethod
163-
def func2(cls, x: str) -> str:
164-
pass
165-
166-
@staticmethod
167-
def func3(x: str) -> str:
168-
pass
169-
[builtins fixtures/classmethod.pyi]
170-
171-
[case testOverrideCallableUnionAttributeWithMethod]
172-
from typing import Callable, Union
173-
174-
class Base:
175-
func1: Union[Callable[[str], str], str]
176-
func2: Union[Callable[[str], str], str]
177-
func3: Union[Callable[[str], str], str]
178-
179-
class Derived(Base):
180-
def func1(self, x: str) -> str:
181-
pass
182-
183-
@classmethod
184-
def func2(cls, x: str) -> str:
185-
pass
186-
187-
@staticmethod
188-
def func3(x: str) -> str:
189-
pass
190-
[builtins fixtures/classmethod.pyi]
191-
192150
[case testOverridePartialAttributeWithMethod]
193151
# This was crashing: https://github.com/python/mypy/issues/11686.
194152
class Base:
@@ -772,19 +730,6 @@ class B(A):
772730
pass
773731
[builtins fixtures/classmethod.pyi]
774732

775-
[case testOverrideCallableAttributeWithSettableProperty]
776-
from typing import Callable
777-
778-
class A:
779-
f: Callable[[str], None]
780-
781-
class B(A):
782-
@property
783-
def f(self) -> Callable[[object], None]: pass
784-
@func.setter
785-
def f(self, x: object) -> None: pass
786-
[builtins fixtures/property.pyi]
787-
788733
[case testOverrideCallableAttributeWithMethodMutableOverride]
789734
# flags: --enable-error-code=mutable-override
790735
from typing import Callable
@@ -804,6 +749,19 @@ class B(A):
804749
def f3(x: object) -> None: pass # E: Covariant override of a mutable attribute (base class "A" defined the type as "Callable[[str], None]", override has type "Callable[[object], None]")
805750
[builtins fixtures/classmethod.pyi]
806751

752+
[case testOverrideCallableAttributeWithSettableProperty]
753+
from typing import Callable
754+
755+
class A:
756+
f: Callable[[str], None]
757+
758+
class B(A):
759+
@property
760+
def f(self) -> Callable[[object], None]: pass
761+
@func.setter
762+
def f(self, x: object) -> None: pass
763+
[builtins fixtures/property.pyi]
764+
807765
[case testOverrideCallableAttributeWithSettablePropertyMutableOverride]
808766
# flags: --enable-error-code=mutable-override
809767
from typing import Callable
@@ -818,6 +776,27 @@ class B(A):
818776
def f(self, x: object) -> None: pass
819777
[builtins fixtures/property.pyi]
820778

779+
[case testOverrideCallableUnionAttributeWithMethod]
780+
from typing import Callable, Union
781+
782+
class Base:
783+
f1: Union[Callable[[str], str], str]
784+
f2: Union[Callable[[str], str], str]
785+
f3: Union[Callable[[str], str], str]
786+
787+
class Derived(Base):
788+
def f1(self, x: str) -> str:
789+
pass
790+
791+
@classmethod
792+
def f2(cls, x: str) -> str:
793+
pass
794+
795+
@staticmethod
796+
def f3(x: str) -> str:
797+
pass
798+
[builtins fixtures/classmethod.pyi]
799+
821800
-- Constructors
822801
-- ------------
823802

0 commit comments

Comments
 (0)