Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bank provider for cs_CZ #1968

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions faker/providers/bank/cs_CZ/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .. import Provider as BankProvider


class Provider(BankProvider):
"""Implement bank provider for ``cs_CZ`` locale.
https://www.mbank.cz/informace-k-produktum/info/ucty/cislo-uctu-iban.html
"""

bban_format = "####################"
country_code = "CZ"
16 changes: 16 additions & 0 deletions tests/providers/test_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from faker.providers.bank import Provider as BankProvider
from faker.providers.bank.az_AZ import Provider as AzAzBankProvider
from faker.providers.bank.cs_CZ import Provider as CsCZBankProvider
from faker.providers.bank.de_CH import Provider as DeChBankProvider
from faker.providers.bank.el_GR import Provider as ElGrBankProvider
from faker.providers.bank.en_GB import Provider as EnGbBankProvider
Expand Down Expand Up @@ -56,6 +57,21 @@ def test_bank(self, faker, num_samples):
bank = faker.bank()
assert bank in AzAzBankProvider.banks

class TestCsCz:
"""Test cs_CZ bank provider"""

def test_bban(self, faker, num_samples):
for _ in range(num_samples):
assert re.fullmatch(r"\d{20}", 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] == CsCZBankProvider.country_code
assert re.fullmatch(r"\d{2}\d{20}", iban[2:])



class TestNoNo:
"""Test no_NO bank provider"""
Expand Down