Skip to content

Conversation

@WenwenHLF
Copy link

Change Description

This commit adds international PHONE_NUMBER test cases for Presidio Analyzer:

  • Japanese mobile number formats: 090/080/070
  • Chinese mobile number formats: 11-digit numbers starting with 1

These tests improve international coverage for the PhoneRecognizer.

Checklist

  • [ √] I have reviewed the contribution guidelines
  • I have signed the CLA (if required)
  • [ √] My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

This commit adds international PHONE_NUMBER test cases for Presidio Analyzer:

- Japanese mobile number formats: 090/080/070
- Chinese mobile number formats: 11-digit numbers starting with 1

These tests improve international coverage for the PhoneRecognizer.
@omri374
Copy link
Contributor

omri374 commented Dec 4, 2025

Hi @WenwenHLF, Presidio has a few default regions for the phone recognizers. Japan and China are not part of the default, so it's likely not going to work. If you'd like, add Japan and China to the supported regions in the test.

recognizer = PhoneRecognizer(leniency=leniency)

DEFAULT_SUPPORTED_REGIONS = ("US", "UK", "DE", "FE", "IL", "IN", "CA", "BR")

See this comment for more info on defining regions:
#1341 (comment)

…s override

This update adds Japanese and Chinese phone number examples to the phone recognizer test suite. The recognizer fixture is extended with supported_regions = DEFAULT_SUPPORTED_REGIONS + ("JP", "CN") so that the new cases can be detected without changing the library’s default behavior.

Only the test fixture is modified; leniency and other tests remain unchanged.
@WenwenHLF WenwenHLF closed this Dec 4, 2025
@WenwenHLF WenwenHLF reopened this Dec 4, 2025
@WenwenHLF
Copy link
Author

Hi @omri374 , Thanks for the suggestion! I've updated the test fixture so that PhoneRecognizer is initialized with JP and CN added to supported_regions. This allows the new test cases to pass without modifying the default regions.
Please let me know if any further adjustments are needed.

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.

4 participants