python-stdnum branch master updated. 2.1-11-g7ca9b6c
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 2.1-11-g7ca9b6c
- 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. 2.1-11-g7ca9b6c
- Date: Sun, 26 Oct 2025 12:48:09 +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 7ca9b6ce7b1f2b4d1bf164c2af83a8a77bc919d2 (commit)
from a1fdd5d5f39ec3d92da8fb1ab976d9e7175a571a (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=7ca9b6ce7b1f2b4d1bf164c2af83a8a77bc919d2
commit 7ca9b6ce7b1f2b4d1bf164c2af83a8a77bc919d2
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sun Oct 26 12:44:39 2025 +0100
Validate first digit of Belgian VAT number
Thanks to antonio-ginestar find pointing this out.
Closes https://github.com/arthurdejong/python-stdnum/issues/488
diff --git a/stdnum/be/vat.py b/stdnum/be/vat.py
index d4c235b..982d5ae 100644
--- a/stdnum/be/vat.py
+++ b/stdnum/be/vat.py
@@ -1,6 +1,6 @@
# vat.py - functions for handling Belgian VAT numbers
#
-# Copyright (C) 2012-2016 Arthur de Jong
+# Copyright (C) 2012-2025 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
@@ -67,6 +67,8 @@ def validate(number: str) -> str:
raise InvalidFormat()
if len(number) != 10:
raise InvalidLength()
+ if not number[0] in '01':
+ raise InvalidComponent()
if checksum(number) != 0:
raise InvalidChecksum()
return number
diff --git a/tests/test_be_vat.doctest b/tests/test_be_vat.doctest
index 5d68441..8f01a3a 100644
--- a/tests/test_be_vat.doctest
+++ b/tests/test_be_vat.doctest
@@ -1,6 +1,6 @@
test_be_vat.doctest - more detailed doctests for stdnum.be.vat module
-Copyright (C) 2020 Arthur de Jong
+Copyright (C) 2020-2025 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
@@ -31,7 +31,15 @@ Tests for corner cases.
Traceback (most recent call last):
...
InvalidFormat: ...
+>>> vat.validate('BE000000000')
+Traceback (most recent call last):
+ ...
+InvalidFormat: ...
>>> vat.validate('000000')
Traceback (most recent call last):
...
InvalidFormat: ...
+>>> vat.validate('BE2000021323')
+Traceback (most recent call last):
+ ...
+InvalidComponent: ...
-----------------------------------------------------------------------
Summary of changes:
stdnum/be/vat.py | 4 +++-
tests/test_be_vat.doctest | 10 +++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 2.1-11-g7ca9b6c,
Commits of the python-stdnum project