fix: python>=3.12正则产生的warnings#98
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes Python 3.12 regex SyntaxWarnings by converting literal patterns to raw strings and adds unit tests to verify warning behavior.
- Updated regex patterns in
deal_isolate_span,deal_duplicate_bb, and related utilities to use raw string literals. - Added tests to assert that invalid escape sequences trigger warnings and that raw-string patterns do not.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rapid_table/table_matcher/utils.py | Prefixed all regex pattern strings with r"" to suppress invalid escape sequence warnings |
| tests/table_matcher/utils.py | Added tests to capture SyntaxWarning for non-raw patterns and ensure raw patterns pass |
Comments suppressed due to low confidence (2)
tests/table_matcher/utils.py:5
- [nitpick] The test class name 'TestAddFunction' is ambiguous—consider renaming it to reflect that it validates regex warnings, e.g., 'TestRegexWarning'.
class TestAddFunction(unittest.TestCase):
rapid_table/table_matcher/utils.py:31
- The updated regex in
deal_isolate_spanisn’t covered by functional tests. Consider adding unit tests to verify that spans are extracted correctly.
r'<td></td> rowspan="(\d)+" colspan="(\d)+"></b></td>|'
koevas1226
force-pushed
the
fix-reg-warnings
branch
from
June 20, 2025 11:55
eb3a131 to
d00c15e
Compare
Member
|
LGTM |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
相关issue: #94