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 -----------------------------------------------------------------

commit 53f13b4af087250e43f8841c01906e46d5687b44
Author: Alexis de Lattre <>
Date:   Thu Jan 21 21:17:33 2021 +0100

    Add support for XI VAT numbers in vatin

diff --git a/stdnum/ b/stdnum/
index 76df143..a8553d2 100644
--- a/stdnum/
+++ b/stdnum/
@@ -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 
 >>> vatin.validate('CHE-109.298.651 TVA')
+>>> vatin.validate('XI 432525179')
 Try validating invalid VAT numbers for country with validation:


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