-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-124130: Increase test coverage for \b and \B in regular expressions #124330
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
gh-124130: Increase test coverage for \b and \B in regular expressions #124330
Conversation
@@ -883,31 +883,137 @@ def test_named_unicode_escapes(self): | |||
self.checkPatternError(br'\N{LESS-THAN SIGN}', r'bad escape \N', 0) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 <[email protected]>
GH-124414 is a backport of this pull request to the 3.12 branch. |
…ressions (GH-124330) (GH-124414) (cherry picked from commit b82f076) Co-authored-by: Serhiy Storchaka <[email protected]>
…ressions (GH-124330) (GH-124413) (cherry picked from commit b82f076) Co-authored-by: Serhiy Storchaka <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.