python-stdnum branch master updated. 1.19-3-g58d6283
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.19-3-g58d6283
- 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-3-g58d6283
- Date: Sun, 12 Nov 2023 15:04:44 +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 58d6283fece21f2b7a0f9424cd657288793654fc (commit)
from 1a5db1f405f2983fa36b50e6969d42c2ec12f8a2 (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=58d6283fece21f2b7a0f9424cd657288793654fc
commit 58d6283fece21f2b7a0f9424cd657288793654fc
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sun Nov 12 14:10:11 2023 +0100
Ensure EU VAT numbers don't accept duplicate country codes
diff --git a/stdnum/ro/cf.py b/stdnum/ro/cf.py
index 7c8006f..e6b7511 100644
--- a/stdnum/ro/cf.py
+++ b/stdnum/ro/cf.py
@@ -1,7 +1,7 @@
# cf.py - functions for handling Romanian CF (VAT) numbers
# coding: utf-8
#
-# Copyright (C) 2012-2020 Arthur de Jong
+# Copyright (C) 2012-2023 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
@@ -56,7 +56,7 @@ def validate(number):
# apparently a CNP can also be used (however, not all sources agree)
cnp.validate(cnumber)
elif 2 <= len(cnumber) <= 10:
- cui.validate(cnumber)
+ cui.validate(number)
else:
raise InvalidLength()
return number
diff --git a/tests/test_eu_vat.doctest b/tests/test_eu_vat.doctest
index 7f81ec4..57960a6 100644
--- a/tests/test_eu_vat.doctest
+++ b/tests/test_eu_vat.doctest
@@ -1,6 +1,6 @@
test_eu_vat.doctest - more detailed doctests for the stdnum.eu.vat module
-Copyright (C) 2012-2021 Arthur de Jong
+Copyright (C) 2012-2023 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
@@ -883,3 +883,41 @@ EU VAT module should not return the prefix twice.
>>> vat.compact('RO 21996566')
'RO21996566'
+
+
+Otherwise valid numbers with duplicated prefixes should not be considered
valid.
+
+>>> numbers = '''
+...
+... AT ATU 65033803
+... ATU ATU 65033803
+... BE BE 0220764971
+... BG BG 175074752
+... CY CY 00632993F
+... CZ CZ 61467839
+... DE DE 246595415
+... DK DK 20646446
+... EE EE 100931558
+... EL EL 094501040
+... ES ES Y5277343F
+... EU EU 372022452
+... FI FI 20946063
+... FR FR 23000047372
+... HU HU 18206373
+... IE IE 4550159S
+... IT IT 06863340961
+... LT LT 354991917
+... LU LU 20993674
+... LV LV 40003754957
+... MT MT 19661023
+... NL NL 818643778B01
+... PL PL 7671325342
+... RO RO 16621241
+... SE SE 556043606401
+... SI SI 70310815
+... SK SK 2022749619
+... XI XI 432525179
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and vat.is_valid(x)]
+[]
-----------------------------------------------------------------------
Summary of changes:
stdnum/ro/cf.py | 4 ++--
tests/test_eu_vat.doctest | 40 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 41 insertions(+), 3 deletions(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 1.19-3-g58d6283,
Commits of the python-stdnum project