Fix regression in error message introduced in bpo-29951. by serhiy-storchaka · Pull Request #2028 · python/cpython
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
If you can, it would be nice to have one unit test for the error message. It seems like this case is not currently tested by test_call.
|
|
||
| def test_varargs3(self): | ||
| msg = r"from_bytes\(\) takes at most 2 positional arguments \(3 given\)" | ||
| self.assertRaisesRegex(TypeError, msg, int.from_bytes, b'a', 'little', False) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unit test is wrong: it doesn't catch the fixed bug. You need to add "^" at the start of the regex.
You may add "^" and "$" to all regex of this file ;-) (Maybe even write an helper function to create the regex?)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters