You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #2174 correctly replaced the invalid libphonenumber region code "UK" with "GB" in PhoneRecognizer.DEFAULT_SUPPORTED_REGIONS. However, the added regression case does not prove that change: it only asserts the result count, span, entity type, and score.
If "GB" is changed back to "UK", the example 020 7946 0958 is still recognized by unrelated region matchers. The test fixture also appends "JP" and "CN", and EntityRecognizer.remove_duplicates() collapses the identical spans to one result. The regression case therefore still passes with the broken default.
The unreleased changelog entry also says national-format UK numbers were never detected by default. For this example, they can be detected through an unrelated region matcher, but they are not interpreted with GB metadata.
Observe that the existing regression case still receives one deduplicated result with the expected span and score, even though "UK" remains unsupported.
Expected behavior
The regression coverage should fail whenever an unsupported default region is introduced and should verify that the national-format UK number is attributed to the GB region.
Suggested coverage:
Assert that every DEFAULT_SUPPORTED_REGIONS entry belongs to phonenumbers.SUPPORTED_REGIONS.
Analyze 020 7946 0958 with the real default recognizer and assert that its textual explanation identifies the GB region.
Update the changelog wording to explain that the invalid "UK" pass could not apply GB metadata and that matches could depend on unrelated regional matchers.
Describe the bug
PR #2174 correctly replaced the invalid libphonenumber region code
"UK"with"GB"inPhoneRecognizer.DEFAULT_SUPPORTED_REGIONS. However, the added regression case does not prove that change: it only asserts the result count, span, entity type, and score.If
"GB"is changed back to"UK", the example020 7946 0958is still recognized by unrelated region matchers. The test fixture also appends"JP"and"CN", andEntityRecognizer.remove_duplicates()collapses the identical spans to one result. The regression case therefore still passes with the broken default.The unreleased changelog entry also says national-format UK numbers were never detected by default. For this example, they can be detected through an unrelated region matcher, but they are not interpreted with GB metadata.
Related: #2173 and #2174.
To Reproduce
mainafter fix(analyzer): use valid region code GB instead of UK in PhoneRecognizer #2174.PhoneRecognizer.DEFAULT_SUPPORTED_REGIONSfrom"GB"back to"UK".phonenumbers==9.0.34:"UK"remains unsupported.Expected behavior
The regression coverage should fail whenever an unsupported default region is introduced and should verify that the national-format UK number is attributed to the
GBregion.Suggested coverage:
DEFAULT_SUPPORTED_REGIONSentry belongs tophonenumbers.SUPPORTED_REGIONS.020 7946 0958with the real default recognizer and assert that its textual explanation identifies theGBregion."UK"pass could not apply GB metadata and that matches could depend on unrelated regional matchers.Screenshots
Not applicable.
Additional context
mainafter fix(analyzer): use valid region code GB instead of UK in PhoneRecognizer #21749.0.343.13.7"UK"and pass with"GB".