Skip to content

fix(en_IN, es_MX, zh_CN): inherit en_GB bank provider so GB iban() is valid - #2413

Open
CedricConday wants to merge 2 commits into
joke2k:masterfrom
CedricConday:fix/iban-gb
Open

fix(en_IN, es_MX, zh_CN): inherit en_GB bank provider so GB iban() is valid#2413
CedricConday wants to merge 2 commits into
joke2k:masterfrom
CedricConday:fix/iban-gb

Conversation

@CedricConday

@CedricConday CedricConday commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

These locales fall back to GB IBANs but lacked a correct bank provider, producing invalid IBANs. They now inherit the en_GB bank provider.

Verified against python-stdnum (reference IBAN validator): 300/300 generated IBANs pass stdnum.iban.validate(). Existing tests/providers/test_bank.py suite passes. Includes a regression test.


AI disclosure: Prepared with AI assistance (Claude / Claude Code). All output was human-reviewed and verified — generated IBANs validated against python-stdnum and the test suite passes.

…cales type-check

en_IN, es_MX and zh_CN now inherit en_GB.Provider; en_GB's untyped 'banks'
tuple was inferred as fixed-length, making those subclasses' differing bank
lists fail mypy as incompatible overrides. Annotating the base as
Tuple[str, ...] resolves it.
@fcurella

Copy link
Copy Markdown
Collaborator

these shouldn't inherit from en_GB, but from a more abstract BankIBAN provider. Also, if they don't support IBAn (like China and Mexico), the iban should either raise NotImplemented, or return en_GB as fallback.

@CedricConday

Copy link
Copy Markdown
Contributor Author

The three locales in this PR already emit GB IBANs today — the base provider defaults country_code = "GB", so inheriting en_GB makes that explicit rather than changing it.

The same holds for fil_PH, fr_CH, it_CH, ru_RU, tl_PH, and every locale with no bank provider at all: Faker('en_US').iban() returns a GB IBAN too.

Happy to add the abstract IBAN provider and have non-IBAN locales raise, but that breaks iban() for every locale relying on the current default. Would you want that as its own PR against a major version, with this one closed or narrowed to just the type annotation?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants