Skip to content

Fix: assertRaises / assertRaisesRegex / assertWarns / assertWarnsRegex take the msg argument as keyword-only #8631

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

Merged
merged 1 commit into from
Aug 27, 2022
Merged
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
10 changes: 8 additions & 2 deletions stdlib/unittest/case.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ class TestCase:
**kwargs: Any,
) -> None: ...
@overload
def assertRaises(self, expected_exception: type[_E] | tuple[type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ...
def assertRaises(
self, expected_exception: type[_E] | tuple[type[_E], ...], *, msg: Any = ...
) -> _AssertRaisesContext[_E]: ...
@overload
def assertRaisesRegex( # type: ignore[misc]
self,
Expand All @@ -165,6 +167,7 @@ class TestCase:
self,
expected_exception: type[_E] | tuple[type[_E], ...],
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
*,
msg: Any = ...,
) -> _AssertRaisesContext[_E]: ...
@overload
Expand All @@ -176,7 +179,9 @@ class TestCase:
**kwargs: _P.kwargs,
) -> None: ...
@overload
def assertWarns(self, expected_warning: type[Warning] | tuple[type[Warning], ...], msg: Any = ...) -> _AssertWarnsContext: ...
def assertWarns(
self, expected_warning: type[Warning] | tuple[type[Warning], ...], *, msg: Any = ...
) -> _AssertWarnsContext: ...
@overload
def assertWarnsRegex( # type: ignore[misc]
self,
Expand All @@ -191,6 +196,7 @@ class TestCase:
self,
expected_warning: type[Warning] | tuple[type[Warning], ...],
expected_regex: str | bytes | Pattern[str] | Pattern[bytes],
*,
msg: Any = ...,
) -> _AssertWarnsContext: ...
def assertLogs(
Expand Down