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
- From: Commits of the python-stdnum project <python-stdnum-commits [at] lists.arthurdejong.org>
- To: python-stdnum-commits [at] lists.arthurdejong.org
- Reply-to: python-stdnum-users [at] lists.arthurdejong.org
- Subject: python-stdnum branch master updated. 1.9-13-g58ea7b2
- Date: Tue, 9 Oct 2018 22:11:42 +0200 (CEST)
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 -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=58ea7b20682021e9ed91587adb484534fb7a768f
commit 58ea7b20682021e9ed91587adb484534fb7a768f
Author: Arthur de Jong <arthur@arthurdejong.org>
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
valid.
Closes https://github.com/arthurdejong/python-stdnum/issues/84
diff --git a/stdnum/iban.py b/stdnum/iban.py
index 09c8fdb..bbf181b 100644
--- a/stdnum/iban.py
+++ b/stdnum/iban.py
@@ -106,7 +106,7 @@ def validate(number, check_country=True):
info = _ibandb.info(number)
# 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
numbers:
-----------------------------------------------------------------------
Summary of changes:
stdnum/iban.py | 2 +-
tests/test_iban.doctest | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
hooks/post-receive
--
python-stdnum
--
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/python-stdnum-commits/
- python-stdnum branch master updated. 1.9-13-g58ea7b2,
Commits of the python-stdnum project