RSS feed

python-stdnum branch master updated. 1.9-13-g58ea7b2

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.9-13-g58ea7b2

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  58ea7b20682021e9ed91587adb484534fb7a768f (commit)
      from  54c36507220a9f39a14fade446d779315e37a270 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------

commit 58ea7b20682021e9ed91587adb484534fb7a768f
Author: Arthur de Jong <>
Date:   Tue Oct 9 22:07:33 2018 +0200

    Fix issue with minimal IBAN
    This ensures that an IBAN with a missing bban part and unknown country
    code (while still having a valid MOD 97,10 checksum) is considered

diff --git a/stdnum/ b/stdnum/
index 09c8fdb..bbf181b 100644
--- a/stdnum/
+++ b/stdnum/
@@ -106,7 +106,7 @@ def validate(number, check_country=True):
     info =
     # check if the bban part of number has the correct structure
     bban = number[4:]
-    if not _struct_to_re(info[0][1].get('bban', '')).match(bban):
+    if not _struct_to_re(info[0][1].get('bban', '-')).match(bban):
         raise InvalidFormat()
     # check the country-specific module if it exists
     if check_country:
diff --git a/tests/test_iban.doctest b/tests/test_iban.doctest
index eef1948..0625fb1 100644
--- a/tests/test_iban.doctest
+++ b/tests/test_iban.doctest
@@ -25,6 +25,15 @@ really useful as module documentation.
 >>> from stdnum import iban
+Test for IBAN corner case that happens when the bban part is empty, the
+country code is unknown and the checksum is still valid.
+>>> iban.validate('0001')
+Traceback (most recent call last):
+    ...
+InvalidFormat: ...
 These should all be valid numbers and are from the IBAN REGISTRY as sample


Summary of changes:
 stdnum/          | 2 +-
 tests/test_iban.doctest | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

To unsubscribe send an email to or see