gh-119949: refactor test_exc() helper in test_format.py#135452
Conversation
Use assertRaisesRegex() context and fix python#119781 (review)
|
CC @JelleZijlstra, It's a follow-up of pr #119781 |
|
To minimize the diff, you can add methods, and then use local variables as aliases. def _test_exc(self, formatstr, args, exception, excmsg):
...
def test_something(self):
test_exc = self._test_exc
... |
Documentation build overview
479 files changed ·
|
Done. Unfortunately, some tests still should be changed due to using assertRaisesRegex instead of string comparison. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
You can use re.escape() to minimize the diff.
|
Thanks @skirpichev for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
Sorry, @skirpichev and @serhiy-storchaka, I could not cleanly backport this to |
|
GH-150329 is a backport of this pull request to the 3.15 branch. |
|
@serhiy-storchaka, I think it doesn't make sense to backport this for 3.14 as #142081 wasn't backported. |
Use assertRaisesRegex() context and fix #119781 (review)