@@ -29,12 +29,18 @@ Normal values that should just work.
29
29
30
30
>>> vat.validate('980780684') # standard number
31
31
'980780684'
32
+ >>> vat.validate('100190874') # standard number restarting
33
+ '100190874'
32
34
>>> vat.validate('242338087388') # branch trader
33
35
'242338087388'
34
36
>>> vat.validate('GD100') # government department
35
37
'GD100'
36
38
>>> vat.validate('HA501') # health authority
37
39
'HA501'
40
+ >>> vat.validate('GD888810003') # government department for EU
41
+ 'GD888810003'
42
+ >>> vat.validate('HA888856782') # health authority for EU
43
+ 'HA888856782'
38
44
39
45
40
46
Invalid long numbers:
@@ -51,6 +57,14 @@ InvalidLength: ...
51
57
Traceback (most recent call last):
52
58
...
53
59
InvalidFormat: ...
60
+ >>> vat.validate('GD8888567B2') # invalid digit for EU health authority
61
+ Traceback (most recent call last):
62
+ ...
63
+ InvalidFormat: ...
64
+ >>> vat.validate('001234567') # invalid checksum
65
+ Traceback (most recent call last):
66
+ ...
67
+ InvalidChecksum: ...
54
68
55
69
56
70
Some variations on the short format:
@@ -69,6 +83,22 @@ Traceback (most recent call last):
69
83
InvalidComponent: ...
70
84
71
85
86
+ Some variations on the EU format:
87
+
88
+ >>> vat.validate('GD888860018') # government department with high number
89
+ Traceback (most recent call last):
90
+ ...
91
+ InvalidComponent: ...
92
+ >>> vat.validate('HA888820107') # health authority with low number
93
+ Traceback (most recent call last):
94
+ ...
95
+ InvalidComponent: ...
96
+ >>> vat.validate('HA888856700') # health authority with invalid checksum
97
+ Traceback (most recent call last):
98
+ ...
99
+ InvalidChecksum: ...
100
+
101
+
72
102
Formatting tests:
73
103
74
104
>>> vat.format('980780684') # standard number
0 commit comments