Repository: joke2k/faker

Issue:
Fake IBAN for Switzerland should be of 21 characters in length
* Faker version: 4.1.0

Fake IBAN for Swiss locale should be 21 characters long, is 22 characters long now.

### Steps to reproduce

    >>> swiss_iban = Faker('de_CH').iban()
    >>> swiss_iban
    'GB80WQBB93456553336766'
    >>> len(swiss_iban)
    22

### Expected behavior

    >>> swiss_iban = Faker('de_CH').iban()
    >>> swiss_iban
    'CH4489144168326729379'
    >>> len(swiss_iban)
    21

### Actual behavior

    >>> len(swiss_iban)
    22



Discussion:
I made a custom provider to workaround it.

    class CHBankProvider(Provider):
        country_code = 'CH'
        bban_format = '#################'

    faker = Faker('CH')
    faker.add_provider(CHBankProvider())

    >>> swiss_iban = faker.iban()
    >>> swiss_iban
    'CH4489144168326729379'
    >>> len(swiss_iban)
    21
Thank you for the report @m-aciek ! Feel free to submit a Pull Request! :)

Resolving patch:
diff --git a/faker/providers/bank/de_CH/__init__.py b/faker/providers/bank/de_CH/__init__.py
new file mode 100644
--- /dev/null
+++ b/faker/providers/bank/de_CH/__init__.py
@@ -0,0 +1,8 @@
+from .. import Provider as BankProvider
+
+
+class Provider(BankProvider):
+    """Implement bank provider for ``de_CH`` locale."""
+
+    bban_format = '#################'
+    country_code = 'CH'
diff --git a/faker/providers/bank/fr_CH/__init__.py b/faker/providers/bank/fr_CH/__init__.py
new file mode 100644
--- /dev/null
+++ b/faker/providers/bank/fr_CH/__init__.py
@@ -0,0 +1,9 @@
+from ..de_CH import Provider as DeChBankProvider
+
+
+class Provider(DeChBankProvider):
+    """Implement bank provider for ``fr_CH`` locale.
+
+    There is no difference from the ``de_CH`` implementation.
+    """
+    pass
diff --git a/faker/providers/bank/it_CH/__init__.py b/faker/providers/bank/it_CH/__init__.py
new file mode 100644
--- /dev/null
+++ b/faker/providers/bank/it_CH/__init__.py
@@ -0,0 +1,9 @@
+from ..de_CH import Provider as DeChBankProvider
+
+
+class Provider(DeChBankProvider):
+    """Implement bank provider for ``it_CH`` locale.
+
+    There is no difference from the ``de_CH`` implementation.
+    """
+    pass


Test patch:
diff --git a/tests/providers/test_bank.py b/tests/providers/test_bank.py
--- a/tests/providers/test_bank.py
+++ b/tests/providers/test_bank.py
@@ -3,6 +3,7 @@
 import pytest
 
 from faker.providers.bank import Provider as BankProvider
+from faker.providers.bank.de_CH import Provider as DeChBankProvider
 from faker.providers.bank.en_GB import Provider as EnGbBankProvider
 from faker.providers.bank.en_PH import Provider as EnPhBankProvider
 from faker.providers.bank.es_ES import Provider as EsEsBankProvider
@@ -207,3 +208,28 @@ def test_iban(self, faker, num_samples):
             assert is_valid_iban(iban)
             assert iban[:2] == TrTrBankProvider.country_code
             assert re.fullmatch(r"\d{2}\d{22}", iban[2:])
+
+
+class TestDeCh:
+    """Test de_CH bank provider"""
+
+    def test_bban(self, faker, num_samples):
+        for _ in range(num_samples):
+            assert re.fullmatch(r"\d{17}", 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] == DeChBankProvider.country_code
+            assert re.fullmatch(r"\d{19}", iban[2:])
+
+
+class TestFrCh(TestDeCh):
+    """Test fr_CH bank provider"""
+    pass
+
+
+class TestItCh(TestDeCh):
+    """Test it_CH bank provider"""
+    pass