From fd95299e4bb291493596a815a97d28e5076202f3 Mon Sep 17 00:00:00 2001 From: CedricConday Date: Wed, 1 Jul 2026 10:51:30 +0000 Subject: [PATCH] fix(en_IE): generate structurally valid Irish IBANs The en_IE bank provider used a 23-digit bban_format, producing 27-character all-numeric IBANs. Ireland's IBAN is 22 characters with an 18-character BBAN of 4 letters (bank identifier) followed by 14 digits (6-digit sort code + 8-digit account), per the ISO 13616 registry. Every generated value failed both length and structure validation (verified with python-stdnum). Correct bban_format to '????##############' and update the existing TestEnIe assertions, which encoded the invalid 23-digit format, to expect the correct 4-letter + 14-digit layout (matching the en_GB test structure). --- faker/providers/bank/en_IE/__init__.py | 2 +- tests/providers/test_bank.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/faker/providers/bank/en_IE/__init__.py b/faker/providers/bank/en_IE/__init__.py index 99793af284..67ec6a665c 100644 --- a/faker/providers/bank/en_IE/__init__.py +++ b/faker/providers/bank/en_IE/__init__.py @@ -4,5 +4,5 @@ class Provider(BankProvider): """Implement bank provider for ``en_IE`` locale.""" - bban_format = "#######################" + bban_format = "????##############" country_code = "IE" diff --git a/tests/providers/test_bank.py b/tests/providers/test_bank.py index 218708c777..35c43d0781 100644 --- a/tests/providers/test_bank.py +++ b/tests/providers/test_bank.py @@ -174,14 +174,14 @@ class TestEnIe: def test_bban(self, faker, num_samples): for _ in range(num_samples): - assert re.fullmatch(r"\d{23}", faker.bban()) + assert re.fullmatch(r"[A-Z]{4}\d{14}", faker.bban()) def test_iban(self, faker, num_samples): for _ in range(num_samples): iban = faker.iban() assert is_valid_iban(iban) assert iban[:2] == EnIeBankProvider.country_code - assert re.fullmatch(r"\d{2}\d{23}", iban[2:]) + assert re.fullmatch(r"\d{2}[A-Z]{4}\d{14}", iban[2:]) class TestEnIn: