Skip to content

test(analyzer): strengthen GB phone regression coverage#2186

Draft
developer0hye wants to merge 2 commits into
data-privacy-stack:mainfrom
developer0hye:agent/phone-recognizer-gb-regression-coverage
Draft

test(analyzer): strengthen GB phone regression coverage#2186
developer0hye wants to merge 2 commits into
data-privacy-stack:mainfrom
developer0hye:agent/phone-recognizer-gb-regression-coverage

Conversation

@developer0hye

Copy link
Copy Markdown
Contributor

Change Description

Strengthen the regression coverage added with #2174 so it proves that PhoneRecognizer.DEFAULT_SUPPORTED_REGIONS uses the valid libphonenumber region code "GB".

The previous test reused a recognizer fixture that appends JP and CN and only checked the deduplicated result's span and score. The national-format example could therefore still match through unrelated regional passes when "GB" was reverted to the unsupported "UK" value.

This PR:

  • asserts that every default region belongs to phonenumbers.SUPPORTED_REGIONS;
  • runs the GB national-format case with the real default recognizer and verifies its GB textual explanation; and
  • clarifies the unreleased changelog entry so it does not overstate the original behavior.

There is no production-code change. The user-facing impact is more reliable regression protection and a more precise changelog description.

Validation:

  • python -m pytest tests/test_phone_recognizer.py: 28 passed
  • Negative control with "GB" temporarily reverted to "UK": both new tests fail
  • git diff --check: passed
  • ruff check tests/test_phone_recognizer.py: reports 25 pre-existing findings on unchanged lines; the added lines have no findings

Issue reference

Fixes #2185

Checklist

  • I have reviewed the contribution guidelines
  • I agree to follow this project's Code of Conduct
  • I confirm that I have the right to submit this contribution and that it does not knowingly contain proprietary or confidential code.
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

@developer0hye

Copy link
Copy Markdown
Contributor Author

The only failing CI check appears unrelated to this PR's changes.

Test Analyzer (Python 3.10) failed in the existing test_analyzer_engine_provider_no_nlp_recognizer_is_added_per_language test while spaCy attempted to download es_core_news_sm:

requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

The Analyzer jobs on Python 3.11, 3.13, and 3.14 passed, as did Linting. Python 3.12 was cancelled by matrix fail-fast after the Python 3.10 failure.

As an external fork contributor, I cannot rerun upstream Actions (gh reports Must have admin rights to Repository). Could a maintainer please rerun the failed and cancelled Analyzer jobs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PhoneRecognizer: GB regression test passes with the old UK default

1 participant