Skip to content

fix: python>=3.12正则产生的warnings#98

Merged
SWHL merged 1 commit into
RapidAI:mainfrom
koevas1226:fix-reg-warnings
Jun 21, 2025
Merged

fix: python>=3.12正则产生的warnings#98
SWHL merged 1 commit into
RapidAI:mainfrom
koevas1226:fix-reg-warnings

Conversation

@koevas1226

Copy link
Copy Markdown
Contributor
  1. 修复了table_matcher-> utils里的一些不规则正则
  2. 添加了单元测试

相关issue: #94

Copilot AI review requested due to automatic review settings June 20, 2025 11:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_span isn’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>|'

@SWHL

SWHL commented Jun 21, 2025

Copy link
Copy Markdown
Member

LGTM

@SWHL
SWHL merged commit 8b0182d into RapidAI:main Jun 21, 2025
@SWHL SWHL added this to the v1.1.0 milestone Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants