def validate(self, value: IBAN): """Validate the IBAN value. Warning: Some invalid IBANs can pass this validation. Specifically, the SWIFT/BIC number of the bank is not verified to be valid. A crafted IBAN value with a correct checksum but fake BIC slip through. Args: value: The IBAN value to validate. """ errors = super().validate(value) try: value.validate() except ValueError as err: errors.append(f'IBAN INVALID: {err}') return errors
def test_parse_iban_allow_invalid(number): iban = IBAN(number, allow_invalid=True) with pytest.raises(SchwiftyException): iban.validate()
def test_parse_iban_allow_invalid(number): iban = IBAN(number, allow_invalid=True) with pytest.raises(ValueError): iban.validate()
def test_parse_iban_allow_invalid(number): iban = IBAN(number, allow_invalid=True) with pytest.raises(ValueError): iban.validate()