diff --git a/schwifty/bban.py b/schwifty/bban.py index 1d46206..e26924e 100644 --- a/schwifty/bban.py +++ b/schwifty/bban.py @@ -105,7 +105,7 @@ def from_components(cls, country_code: str, **values: str) -> BBAN: InvalidAccountCode: If the account code does not meet the national requirements. """ spec: dict[str, Any] = _get_bban_spec(country_code) - if "positions" not in spec: + if "positions" not in spec: # pragma: no cover raise exceptions.SchwiftyException(f"BBAN generation for {country_code} not supported") ranges = _get_position_ranges(spec) diff --git a/schwifty/iban.py b/schwifty/iban.py index fdb5afd..6472a79 100644 --- a/schwifty/iban.py +++ b/schwifty/iban.py @@ -12,7 +12,6 @@ from schwifty import exceptions from schwifty import registry from schwifty.bban import BBAN -from schwifty.bban import Component from schwifty.bic import BIC from schwifty.checksum import ISO7064_mod97_10 from schwifty.checksum import numerify @@ -294,13 +293,7 @@ def bic(self) -> BIC | None: .. versionchanged:: 2020.08.1 Returns ``None`` if no appropriate :class:`BIC` can be constructed. """ - key = "" - for attr in self.spec.get("bic_lookup_components", [Component.BANK_CODE]): - key += getattr(self, attr, "") - try: - return BIC.from_bank_code(self.country_code, key) - except exceptions.SchwiftyException: - return None + return self.bban.bic @property def country(self) -> Data | None: diff --git a/tests/test_iban.py b/tests/test_iban.py index 9f7feff..eb5911d 100644 --- a/tests/test_iban.py +++ b/tests/test_iban.py @@ -210,7 +210,11 @@ def test_iban_properties_de() -> None: assert iban.bank_code == "43060967" assert iban.branch_code == "" assert iban.account_code == "7000534100" + assert iban.account_id == "" + assert iban.account_type == "" assert iban.country_code == "DE" + assert iban.currency_code == "" + assert iban.account_holder_id == "" assert iban.national_checksum_digits == "" assert iban.bic == "GENODEM1GLS" assert iban.formatted == "DE42 4306 0967 7000 5341 00" @@ -233,6 +237,15 @@ def test_iban_properties_it() -> None: assert iban.in_sepa_zone is True +def test_iban_properties_is() -> None: + iban = IBAN("IS14 0159 2600 7654 5510 7303 39") + assert iban.account_holder_id == "5510730339" + assert iban.account_code == "007654" + assert iban.account_type == "26" + assert iban.branch_code == "59" + assert iban.bank_code == "01" + + @pytest.mark.parametrize( ("components", "compact"), [