8000 bpo-33967: Remove use of deprecated assertRaisesRegexp() by ZackerySpytz · Pull Request #8261 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-33967: Remove use of deprecated assertRaisesRegexp() #8261

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 3 commits into from
Jul 12, 2018
Merged
Changes from 1 commit
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
8000
Diff view
Prev Previous commit
Update test_functools.py
  • Loading branch information
ZackerySpytz authored Jul 12, 2018
commit 29fb9a2e133e2e8be142f68f2d9e20df69c2548d
2 changes: 1 addition & 1 deletion Lib/test/test_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,7 @@ def test_invalid_positional_argument(self):
def f(*args):
pass
msg = 'f requires at least 1 positional argument'
with self.assertRaises(TypeError, msg):
with self.assertRaises(TypeError, msg=msg):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct use of msg. The correct code is:

with self.assertRaisesRegex(TypeError, msg):

The msg argument of assertRaises() is used for reporting a failure. But it should be used for testing the error message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the code looks wrong, you should reopen https://bugs.python.org/issue33967 and comment there, otherwise your comment may be lost.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry. It was my mistake.

f()

if __name__ == '__main__':
Expand Down
0