lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.18-17-g36858cc

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

python-stdnum branch master updated. 1.18-17-g36858cc



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  36858cc6236529ea7a0991865432ca86d72e8295 (commit)
      from  42d2792bcac8692b2c081dead7a5061a4540abe6 (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=36858cc6236529ea7a0991865432ca86d72e8295

commit 36858cc6236529ea7a0991865432ca86d72e8295
Author: mjturt <maks.turtiainen@gmail.com>
Date:   Mon Feb 13 11:56:48 2023 +0200

    Add support for Finland HETU new century indicating signs
    
    More information at https://dvv.fi/en/reform-of-personal-identity-code
    
    Cloess https://github.com/arthurdejong/python-stdnum/pull/396

diff --git a/stdnum/fi/hetu.py b/stdnum/fi/hetu.py
index 26c538f..b2b866f 100644
--- a/stdnum/fi/hetu.py
+++ b/stdnum/fi/hetu.py
@@ -50,15 +50,15 @@ from stdnum.util import clean
 
 _century_codes = {
     '+': 1800,
-    '-': 1900,
-    'A': 2000,
 }
+_century_codes.update(dict.fromkeys(('-', 'Y', 'X', 'W', 'V', 'U'), 1900))
+_century_codes.update(dict.fromkeys(('A', 'B', 'C', 'D', 'E', 'F'), 2000))
 
 # Finnish personal identity codes are composed of date part, century
 # indicating sign, individual number and control character.
 # ddmmyyciiiC
 _hetu_re = re.compile(r'^(?P<day>[0123]\d)(?P<month>[01]\d)(?P<year>\d\d)'
-                      r'(?P<century>[-+A])(?P<individual>\d\d\d)'
+                      r'(?P<century>[-+ABCDEFYXWVU])(?P<individual>\d\d\d)'
                       r'(?P<control>[0-9ABCDEFHJKLMNPRSTUVWXY])$')
 
 
diff --git a/tests/test_fi_hetu.doctest b/tests/test_fi_hetu.doctest
index 96701fd..8def506 100644
--- a/tests/test_fi_hetu.doctest
+++ b/tests/test_fi_hetu.doctest
@@ -39,6 +39,14 @@ Normal values that should just work.
 >>> hetu.validate('131052a308t')
 '131052A308T'
 
+From the beginning of year 2023, additional century indicating signs were 
added.
+This doesn't affect the checksum calculation.
+
+>>> hetu.validate('131052B308T')
+'131052B308T'
+
+>>> hetu.validate('131052X308T')
+'131052X308T'
 
 Invalid checksum:
 

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

Summary of changes:
 stdnum/fi/hetu.py          | 6 +++---
 tests/test_fi_hetu.doctest | 8 ++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
python-stdnum