lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.18-25-g3848318

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

python-stdnum branch master updated. 1.18-25-g3848318



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  38483183f47b0b12d80e76dd6d37df8f8af06da2 (commit)
      from  be33a801fd1b4728915a89f3f82979cafa3c57f0 (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=38483183f47b0b12d80e76dd6d37df8f8af06da2

commit 38483183f47b0b12d80e76dd6d37df8f8af06da2
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Jul 30 17:54:17 2023 +0200

    Validate first digit of Canadian SIN
    
    See 
http://www.straightlineinternational.com/docs/vaildating_canadian_sin.pdf
    See https://lists.arthurdejong.org/python-stdnum-users/2023/msg00000.html

diff --git a/stdnum/ca/sin.py b/stdnum/ca/sin.py
index 9d07e5b..102b57e 100644
--- a/stdnum/ca/sin.py
+++ b/stdnum/ca/sin.py
@@ -39,6 +39,10 @@ InvalidChecksum: ...
 Traceback (most recent call last):
     ...
 InvalidFormat: ...
+>>> validate('823456785')
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
 >>> format('123456782')
 '123-456-782'
 """
@@ -62,6 +66,8 @@ def validate(number):
         raise InvalidLength()
     if not isdigits(number):
         raise InvalidFormat()
+    if number[0] in '08':
+        raise InvalidComponent()
     return luhn.validate(number)
 
 

-----------------------------------------------------------------------

Summary of changes:
 stdnum/ca/sin.py | 6 ++++++
 1 file changed, 6 insertions(+)


hooks/post-receive
-- 
python-stdnum