File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11# vat.py - functions for handling Belgian VAT numbers
22#
3- # Copyright (C) 2012-2016 Arthur de Jong
3+ # Copyright (C) 2012-2025 Arthur de Jong
44#
55# This library is free software; you can redistribute it and/or
66# modify it under the terms of the GNU Lesser General Public
@@ -67,6 +67,8 @@ def validate(number: str) -> str:
6767 raise InvalidFormat ()
6868 if len (number ) != 10 :
6969 raise InvalidLength ()
70+ if not number [0 ] in '01' :
71+ raise InvalidComponent ()
7072 if checksum (number ) != 0 :
7173 raise InvalidChecksum ()
7274 return number
Original file line number Diff line number Diff line change 11test_be_vat.doctest - more detailed doctests for stdnum.be.vat module
22
3- Copyright (C) 2020 Arthur de Jong
3+ Copyright (C) 2020-2025 Arthur de Jong
44
55This library is free software; you can redistribute it and/or
66modify it under the terms of the GNU Lesser General Public
@@ -31,7 +31,15 @@ Tests for corner cases.
3131Traceback (most recent call last):
3232 ...
3333InvalidFormat: ...
34+ >>> vat.validate('BE000000000')
35+ Traceback (most recent call last):
36+ ...
37+ InvalidFormat: ...
3438>>> vat.validate('000000')
3539Traceback (most recent call last):
3640 ...
3741InvalidFormat: ...
42+ >>> vat.validate('BE2000021323')
43+ Traceback (most recent call last):
44+ ...
45+ InvalidComponent: ...
You can’t perform that action at this time.
0 commit comments