Skip to content
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
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.assertRaisesRegexp(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