Skip to content

Character validation doesn't catch wrong IBAN #266

Description

@DavidVrobel

schwifty/iban.py

I have a IBAN starting Sk22..., first 2 letters should be capital so it is invalid IBAN, but when I call validation on it it passes as valid.

When i tried the regex from _validate_characters function it is working fine so i suspect that self in the method doesn't return string of IBAN.

When I run just this function it returns None and so does just the regex from this function. But I am expecting exception.

def _validate_characters(self) -> None:
        if not re.match(r"[A-Z]{2}\d{2}[A-Z]*", self):
            raise exceptions.InvalidStructure(f"Invalid characters in IBAN {self!s}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions