python-stdnum branch master updated. 1.20-16-g051e63f
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.20-16-g051e63f
- 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.20-16-g051e63f
- Date: Fri, 11 Oct 2024 16:23:47 +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 051e63fd6d617898f8c8ae6f9b1ebc85f29061ce (commit)
from dc850d6c8cc62bcdd88ef5e804f0c86381b97c11 (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=051e63fd6d617898f8c8ae6f9b1ebc85f29061ce
commit 051e63fd6d617898f8c8ae6f9b1ebc85f29061ce
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Fri Oct 11 16:13:35 2024 +0200
Add more tests for Verhoeff implementation
See https://github.com/arthurdejong/python-stdnum/issues/456
diff --git a/tests/test_verhoeff.doctest b/tests/test_verhoeff.doctest
index 4c22e9d..5c5d1e3 100644
--- a/tests/test_verhoeff.doctest
+++ b/tests/test_verhoeff.doctest
@@ -1,6 +1,6 @@
test_verhoeff.doctest - more detailed doctests for stdnum.verhoeff module
-Copyright (C) 2010, 2011, 2013 Arthur de Jong
+Copyright (C) 2010-2024 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -63,3 +63,25 @@ Adding a check digit to the numbers so they are all valid:
'7'
>>> verhoeff.validate('3984382462386423786482364872364827347')
'3984382462386423786482364872364827347'
+
+
+More test cases taken from https://rosettacode.org/wiki/Verhoeff_algorithm
+
+>>> verhoeff.is_valid('123459')
+False
+>>> verhoeff.calc_check_digit('123456789012')
+'0'
+>>> verhoeff.is_valid('1234567890120')
+True
+>>> verhoeff.is_valid('1234567890129')
+False
+>>> verhoeff.calc_check_digit('236')
+'3'
+>>> verhoeff.is_valid('2363')
+True
+>>> verhoeff.is_valid('2369')
+False
+>>> verhoeff.calc_check_digit('12345')
+'1'
+>>> verhoeff.is_valid('123451')
+True
-----------------------------------------------------------------------
Summary of changes:
tests/test_verhoeff.doctest | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 1.20-16-g051e63f,
Commits of the python-stdnum project