gh-124130: Increase test coverage for \b and \B in regular expressions#124330
Conversation
| self.checkPatternError(br'[\N{LESS-THAN SIGN}]', r'bad escape \N', 1) | ||
|
|
||
| def test_string_boundaries(self): | ||
| def test_word_boundaries(self): |
There was a problem hiding this comment.
[no change needed] I think we could use subtests to provide more informative context (basically what you've got in each # comment header) when a test fails? but this is already in keeping with the existing style of this file, so not a big deal. these seem to nicely encode the current behavior state of our re implementation.
There was a problem hiding this comment.
The comments provide context to the reader of the code (so you will know where to add new tests), not when a test fails. The traceback already has all necessary context.
subTest() has two functions:
- Provide more informative context when a test fails. This is especially useful when traceback does not identify the failed test (in a loop, with generated test data).
- Allows to continue execution when a test fails and collect information about other test failures in one run. This works only when tests are independent and
subTest()is well granulated.
It has a drawback -- the traceback is limited and can be less informative if subTest() is used in a helper.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…essions (pythonGH-124330) (cherry picked from commit b82f076) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-124413 is a backport of this pull request to the 3.13 branch. |
…essions (pythonGH-124330) (cherry picked from commit b82f076) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-124414 is a backport of this pull request to the 3.12 branch. |
Uh oh!
There was an error while loading. Please reload this page.