Skip to content

Commit

Permalink
Update fixtures on existing override tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jul 5, 2023
1 parent 7fef24f commit 537e794
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions test-data/unit/check-functions.test
Original file line number Diff line number Diff line change
Expand Up @@ -2752,8 +2752,7 @@ class E(D): pass
class F(E):
@override
def f(self, x: int) -> str: pass
[typing fixtures/typing-full.pyi]
[builtins fixtures/tuple.pyi]
[typing fixtures/typing-override.pyi]

[case explicitOverrideStaticmethod]
# flags: --python-version 3.12
Expand Down Expand Up @@ -2785,8 +2784,8 @@ class D(A):
def f(x: str) -> str: pass # E: Argument 1 of "f" is incompatible with supertype "A"; supertype defines the argument type as "int" \
# N: This violates the Liskov substitution principle \
# N: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
[typing fixtures/typing-full.pyi]
[builtins fixtures/callable.pyi]
[typing fixtures/typing-override.pyi]
[builtins fixtures/staticmethod.pyi]

[case explicitOverrideClassmethod]
# flags: --python-version 3.12
Expand Down Expand Up @@ -2818,8 +2817,8 @@ class D(A):
def f(cls, x: str) -> str: pass # E: Argument 1 of "f" is incompatible with supertype "A"; supertype defines the argument type as "int" \
# N: This violates the Liskov substitution principle \
# N: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
[typing fixtures/typing-full.pyi]
[builtins fixtures/callable.pyi]
[typing fixtures/typing-override.pyi]
[builtins fixtures/classmethod.pyi]

[case explicitOverrideProperty]
# flags: --python-version 3.12
Expand Down Expand Up @@ -2853,8 +2852,8 @@ class D(A):
# N: str \
# N: Subclass: \
# N: int
[typing fixtures/typing-override.pyi]
[builtins fixtures/property.pyi]
[typing fixtures/typing-full.pyi]

[case explicitOverrideSettableProperty]
# flags: --python-version 3.12
Expand Down Expand Up @@ -2891,8 +2890,8 @@ class D(A):

@f.setter
def f(self, value: int) -> None: pass
[typing fixtures/typing-override.pyi]
[builtins fixtures/property.pyi]
[typing fixtures/typing-full.pyi]

[case invalidExplicitOverride]
# flags: --python-version 3.12
Expand All @@ -2907,8 +2906,7 @@ class A: pass
def g() -> None:
@override # E: "override" used with a non-method
def h(b: bool) -> int: pass
[typing fixtures/typing-full.pyi]
[builtins fixtures/tuple.pyi]
[typing fixtures/typing-override.pyi]

[case explicitOverrideSpecialMethods]
# flags: --python-version 3.12
Expand All @@ -2924,8 +2922,7 @@ class B(A):
class C:
@override
def __init__(self, a: int) -> None: pass
[typing fixtures/typing-full.pyi]
[builtins fixtures/tuple.pyi]
[typing fixtures/typing-override.pyi]

[case explicitOverrideFromExtensions]
from typing_extensions import override
Expand All @@ -2936,7 +2933,6 @@ class A:
class B(A):
@override
def f2(self, x: int) -> str: pass # E: Method "f2" is marked as an override, but no base method was found with this name
[typing fixtures/typing-full.pyi]
[builtins fixtures/tuple.pyi]

[case explicitOverrideOverloads]
Expand All @@ -2953,8 +2949,7 @@ class B(A):
def f2(self, x: str) -> str: pass
@override
def f2(self, x: int | str) -> str: pass
[typing fixtures/typing-full.pyi]
[builtins fixtures/tuple.pyi]
[typing fixtures/typing-override.pyi]

[case explicitOverrideNotOnOverloadsImplementation]
# flags: --python-version 3.12
Expand All @@ -2978,8 +2973,7 @@ class C(A):
@overload
def f(self, y: str) -> str: pass
def f(self, y: int | str) -> str: pass
[typing fixtures/typing-full.pyi]
[builtins fixtures/tuple.pyi]
[typing fixtures/typing-override.pyi]

[case explicitOverrideOnMultipleOverloads]
# flags: --python-version 3.12
Expand All @@ -3005,8 +2999,7 @@ class C(A):
def f(self, y: str) -> str: pass
@override
def f(self, y: int | str) -> str: pass
[typing fixtures/typing-full.pyi]
[builtins fixtures/tuple.pyi]
[typing fixtures/typing-override.pyi]

[case requireExplicitOverrideMethod]
# flags: --strict-override-decorator --python-version 3.12
Expand Down

0 comments on commit 537e794

Please sign in to comment.