python-stdnum branch master updated. 1.19-8-gbb20121
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.19-8-gbb20121
- 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, python-stdnum-commits [at] lists.arthurdejong.org
- Subject: python-stdnum branch master updated. 1.19-8-gbb20121
- Date: Sun, 17 Mar 2024 14:21:37 +0100 (CET)
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 bb20121c4e717a7c81fefef04da73dd5b83cda52 (commit)
from 9c7c669ece1491e7fd697f2184ad9b7185be59b2 (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=bb20121c4e717a7c81fefef04da73dd5b83cda52
commit bb20121c4e717a7c81fefef04da73dd5b83cda52
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sun Mar 17 14:18:33 2024 +0100
Fix Ukrainian EDRPOU check digit calculation
This fixes the case where the weighted sum woud be 10 which should
result in a check digit of 0.
Closes https://github.com/arthurdejong/python-stdnum/issues/429
diff --git a/stdnum/ua/edrpou.py b/stdnum/ua/edrpou.py
index b7d3f9f..a286f53 100644
--- a/stdnum/ua/edrpou.py
+++ b/stdnum/ua/edrpou.py
@@ -64,7 +64,7 @@ def calc_check_digit(number):
# Calculate again with other weights
weights = tuple(w + 2 for w in weights)
total = sum(w * int(n) for w, n in zip(weights, number))
- return str(total % 11)
+ return str(total % 11 % 10)
def validate(number):
diff --git a/tests/test_ua_edrpou.doctest b/tests/test_ua_edrpou.doctest
index 32bb979..a51e1df 100644
--- a/tests/test_ua_edrpou.doctest
+++ b/tests/test_ua_edrpou.doctest
@@ -190,6 +190,7 @@ These have been found online and should all be valid
numbers.
... 22800735
... 22815333
... 23226362
+... 23246880
... 23293513
... 23505151
... 23541342
@@ -198,6 +199,7 @@ These have been found online and should all be valid
numbers.
... 24976272
... 24978555
... 25042882
+... 25083040
... 25836018
... 26112972
... 26255795
@@ -279,10 +281,12 @@ These have been found online and should all be valid
numbers.
... 40108625
... 40108866
... 40109173
+... 40599600
... 41399586
... 41436842
... 41475043
... 41617928
+... 41761770
... 41800368
... 41810109
... 42258617
@@ -292,12 +296,15 @@ These have been found online and should all be valid
numbers.
... 42588390
... 42598807
... 43178370
+... 43328020
... 43476227
... 43518172
... 43529818
+... 43573920
... 43586656
... 43618792
... 43629317
+... 43808820
...
... '''
>>> [x for x in numbers.splitlines() if x and not edrpou.is_valid(x)]
-----------------------------------------------------------------------
Summary of changes:
stdnum/ua/edrpou.py | 2 +-
tests/test_ua_edrpou.doctest | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 1.19-8-gbb20121,
Commits of the python-stdnum project