Skip to content

Require ASCII digits in Russian INNs - #543

Open
mjanthony819 wants to merge 2 commits into
python-validators:masterfrom
mjanthony819:fix-ascii-russian-inn
Open

mjanthony819 wants to merge 2 commits into
python-validators:masterfrom
mjanthony819:fix-ascii-russian-inn

Conversation

@mjanthony819

Copy link
Copy Markdown

ru_inn() currently accepts non-ASCII decimal digits because int() converts them to the same numbers as ASCII digits. For example, translating the existing valid company and individual INN examples into fullwidth or Arabic-Indic digits still returns True.

Require an ASCII decimal string before running the existing length and checksum logic. This extends the character-set restriction already applied to Spanish identifiers in #519 and Finnish, French and Indian identifiers in #532. Neither checksum algorithm changes, including the two-check-digit fix in #525.

Ten new regression cases fail before the change and pass afterward. They cover company and individual INNs translated into Arabic-Indic, fullwidth and Devanagari digits, plus single-character substitutions in the first and final positions. The ASCII originals remain accepted.

Validation on Python 3.12:

  • All 1,526 configured tests and doctests pass.
  • Repository-wide Ruff lint and formatting checks pass.
  • Strict Pyright passes with zero errors and warnings using the test environment explicitly.
  • git diff --check passes.

AI assistance covered research, implementation, tests and this description.

This branch has not been deployed

No deployments
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.

1 participant