python-stdnum branch master updated. 1.16-8-geeaf665
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.16-8-geeaf665
- 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.16-8-geeaf665
- Date: Sun, 18 Jul 2021 22:07:17 +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 eeaf6650c1e71e1e838933976f1e692b90760cec (commit)
from e2a95fcf7a1822253159f2a44b36c612a3016269 (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=eeaf6650c1e71e1e838933976f1e692b90760cec
commit eeaf6650c1e71e1e838933976f1e692b90760cec
Author: Dimitri Papadopoulos
<3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Wed Jun 9 10:35:18 2021 +0200
Improve French NIF validation
Closes https://github.com/arthurdejong/python-stdnum/pull/266
diff --git a/stdnum/fr/nif.py b/stdnum/fr/nif.py
index 131c873..4d57e4e 100644
--- a/stdnum/fr/nif.py
+++ b/stdnum/fr/nif.py
@@ -1,7 +1,7 @@
# nif.py - functions for handling French tax identification numbers
# coding: utf-8
#
-# Copyright (C) 2016 Dimitri Papadopoulos
+# Copyright (C) 2016-2021 Dimitri Papadopoulos
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -20,10 +20,10 @@
"""NIF (Numéro d'Immatriculation Fiscale, French tax identification number).
-The NIF (Numéro d'Immatriculation Fiscale, Numéro d'Identité Fiscale or
-Numéro d'Identification Fiscale) also known as numéro fiscal de référence or
-SPI (Simplification des Procédures d'Identification) is a 13-digit number
-issued by the French tax authorities to people for tax reporting purposes.
+The NIF (Numéro d'Immatriculation Fiscale or Numéro d'Identification Fiscale)
+also known as numéro fiscal de référence or SPI (Simplification des
+Procédures d'Identification) is a 13-digit number issued by the French tax
+authorities to people for tax reporting purposes.
More information:
@@ -36,6 +36,10 @@ More information:
Traceback (most recent call last):
...
InvalidLength: ...
+>>> validate('9701987765432')
+Traceback (most recent call last):
+ ...
+InvalidComponent: ...
>>> format('0701987765432')
'07 01 987 765 432'
"""
@@ -55,6 +59,8 @@ def validate(number):
number = compact(number)
if not isdigits(number):
raise InvalidFormat()
+ if number[0] not in ('0', '1', '2', '3'):
+ raise InvalidComponent()
if len(number) != 13:
raise InvalidLength()
return number
-----------------------------------------------------------------------
Summary of changes:
stdnum/fr/nif.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 1.16-8-geeaf665,
Commits of the python-stdnum project