Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
stubtest: fix pos-only handling in overload resolution#16750
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -210,7 +210,13 @@ def test(*args: Any, **kwargs: Any) -> None: | ||
| ) | ||
| actual_errors = set(output.splitlines()) | ||
| if actual_errors != expected_errors: | ||
| output = run_stubtest( | ||
| stub="\n\n".join(textwrap.dedent(c.stub.lstrip("\n")) for c in cases), | ||
| runtime="\n\n".join(textwrap.dedent(c.runtime.lstrip("\n")) for c in cases), | ||
| options=[], | ||
| ) | ||
| assert actual_errors == expected_errors, output | ||
| return test | ||
| @@ -660,6 +666,56 @@ def f6(self, x, /): pass | ||
| """, | ||
| error=None, | ||
| ) | ||
| yield Case( | ||
| stub=""" | ||
| @overload | ||
| def f7(a: int, /) -> int: ... | ||
| @overload | ||
| def f7(b: str, /) -> str: ... | ||
| """, | ||
| runtime="def f7(x, /): pass", | ||
| error=None, | ||
| ) | ||
| yield Case( | ||
| stub=""" | ||
| @overload | ||
| def f8(a: int, c: int = 0, /) -> int: ... | ||
| @overload | ||
| def f8(b: str, d: int, /) -> str: ... | ||
| """, | ||
| runtime="def f8(x, y, /): pass", | ||
| error="f8", | ||
| ) | ||
| yield Case( | ||
| stub=""" | ||
| @overload | ||
| def f9(a: int, c: int = 0, /) -> int: ... | ||
| @overload | ||
| def f9(b: str, d: int, /) -> str: ... | ||
| """, | ||
| runtime="def f9(x, y=0, /): pass", | ||
| error=None, | ||
| ) | ||
| yield Case( | ||
| stub=""" | ||
| class Bar: | ||
| @overload | ||
| def f1(self) -> int: ... | ||
CollaboratorAuthor
| ||
| @overload | ||
| def f1(self, a: int, /) -> int: ... | ||
| @overload | ||
| def f2(self, a: int, /) -> int: ... | ||
| @overload | ||
| def f2(self, a: str, /) -> int: ... | ||
| """, | ||
| runtime=""" | ||
| class Bar: | ||
| def f1(self, *a) -> int: ... | ||
| def f2(self, *a) -> int: ... | ||
| """, | ||
| error=None, | ||
| ) | ||
| @collect_cases | ||
| def test_property(self) -> Iterator[Case]: | ||