Skip to content

Commit

Permalink
Add bank provider for cs_CZ
Browse files Browse the repository at this point in the history
  • Loading branch information
george0st committed Dec 28, 2023
1 parent 3cedfaf commit 5f2422e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
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

0 comments on commit 5f2422e

Please sign in to comment.