Skip to content

Commit

Permalink
Add bank provider for cs_CZ (#1968)
Browse files Browse the repository at this point in the history
  • Loading branch information
george0st committed Jan 10, 2024
1 parent 40ed669 commit 9b2fbd6
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:

Check failure on line 60 in tests/providers/test_bank.py

View workflow job for this annotation

GitHub Actions / flake8

expected 2 blank lines, found 1
"""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:

Check failure on line 76 in tests/providers/test_bank.py

View workflow job for this annotation

GitHub Actions / flake8

too many blank lines (3)
"""Test no_NO bank provider"""
Expand Down

0 comments on commit 9b2fbd6

Please sign in to comment.