lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.15-2-g53f13b4

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

python-stdnum branch master updated. 1.15-2-g53f13b4



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  53f13b4af087250e43f8841c01906e46d5687b44 (commit)
      from  b93d69581f35aa18e7fdd52b3f7fdf06770215e3 (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=53f13b4af087250e43f8841c01906e46d5687b44

commit 53f13b4af087250e43f8841c01906e46d5687b44
Author: Alexis de Lattre <alexis.delattre@akretion.com>
Date:   Thu Jan 21 21:17:33 2021 +0100

    Add support for XI VAT numbers in vatin
    
    Closes https://github.com/arthurdejong/python-stdnum/pull/251

diff --git a/stdnum/vatin.py b/stdnum/vatin.py
index 76df143..a8553d2 100644
--- a/stdnum/vatin.py
+++ b/stdnum/vatin.py
@@ -59,8 +59,8 @@ _country_modules = dict()
 
 def _get_cc_module(cc):
     """Get the VAT number module based on the country code."""
-    # Greece uses a "wrong" country code
-    cc = cc.lower().replace('el', 'gr')
+    # Greece uses a "wrong" country code, special case for Northern Ireland
+    cc = cc.lower().replace('el', 'gr').replace('xi', 'gb')
     if not re.match(r'^[a-z]{2}$', cc):
         raise InvalidFormat()
     if cc not in _country_modules:
diff --git a/tests/test_vatin.doctest b/tests/test_vatin.doctest
index bb86785..4d785c3 100644
--- a/tests/test_vatin.doctest
+++ b/tests/test_vatin.doctest
@@ -38,6 +38,8 @@ Check valid VAT numbers for several countries with existing 
validation:
 'EL082857563'
 >>> vatin.validate('CHE-109.298.651 TVA')
 'CHE109298651TVA'
+>>> vatin.validate('XI 432525179')
+'XI432525179'
 
 
 Try validating invalid VAT numbers for country with validation:

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

Summary of changes:
 stdnum/vatin.py          | 4 ++--
 tests/test_vatin.doctest | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
python-stdnum