Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conformance tests: Fix automated checking on overloads_basic.py #1687

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions conformance/results/mypy/overloads_basic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ overloads_basic.py:37: note: def __getitem__(self, slice, /) -> bytes
overloads_basic.py:62: error: Single overload definition, multiple required [misc]
overloads_basic.py:74: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 64: Expected 1 errors
Line 76: Expected 1 errors
Line 62: Unexpected errors ['overloads_basic.py:62: error: Single overload definition, multiple required [misc]']
Line 74: Unexpected errors ['overloads_basic.py:74: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]']
"""
4 changes: 1 addition & 3 deletions conformance/results/pyre/overloads_basic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ overloads_basic.py:75:0 Missing overload implementation [42]: Overloaded functio
"""
conformance_automated = "Fail"
errors_diff = """
Line 64: Expected 1 errors
Line 76: Expected 1 errors
Line 75: Unexpected errors ['overloads_basic.py:75:0 Missing overload implementation [42]: Overloaded function `func2` must have an implementation.']
Lines 62, 63: Expected error (tag 'func1')
"""
6 changes: 1 addition & 5 deletions conformance/results/pyright/overloads_basic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ overloads_basic.py:37:1 - error: Argument of type "Literal['']" cannot be assign
overloads_basic.py:63:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload)
overloads_basic.py:75:5 - error: "func2" is marked as overload, but no implementation is provided (reportNoOverloadImplementation)
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 64: Expected 1 errors
Line 76: Expected 1 errors
Line 63: Unexpected errors ['overloads_basic.py:63:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload)']
Line 75: Unexpected errors ['overloads_basic.py:75:5 - error: "func2" is marked as overload, but no implementation is provided (reportNoOverloadImplementation)']
"""
4 changes: 2 additions & 2 deletions conformance/results/pytype/overloads_basic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ File "overloads_basic.py", line 58, in map: bad return type [bad-return-type]
"""
conformance_automated = "Fail"
errors_diff = """
Line 64: Expected 1 errors
Line 76: Expected 1 errors
Lines 62, 63: Expected error (tag 'func1')
Lines 74, 75: Expected error (tag 'func2')
Line 31: Unexpected errors ['File "overloads_basic.py", line 31, in __getitem__: bad return type [bad-return-type]']
Line 58: Unexpected errors ['File "overloads_basic.py", line 58, in map: bad return type [bad-return-type]']
"""
12 changes: 6 additions & 6 deletions conformance/tests/overloads_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def map(func: Any, iter1: Any, iter2: Any = ...) -> Any:


# At least two overload signatures should be provided.
@overload
def func1() -> None:
... # E: At least two overloads must be present
@overload # E[func1]
def func1() -> None: # E[func1]: At least two overloads must be present
...


def func1() -> None:
Expand All @@ -71,9 +71,9 @@ def func1() -> None:
# > In regular modules, a series of @overload-decorated definitions must be
# > followed by exactly one non-@overload-decorated definition (for the same
# > function/method).
@overload
def func2(x: int) -> int:
... # E: no implementation
@overload # E[func2]
def func2(x: int) -> int: # E[func2]: no implementation
...


@overload
Expand Down