diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gb_vat.doctest | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_gb_vat.doctest b/tests/test_gb_vat.doctest index cdcfe36..151feb4 100644 --- a/tests/test_gb_vat.doctest +++ b/tests/test_gb_vat.doctest @@ -29,12 +29,18 @@ Normal values that should just work. >>> vat.validate('980780684') # standard number '980780684' +>>> vat.validate('100190874') # standard number restarting +'100190874' >>> vat.validate('242338087388') # branch trader '242338087388' >>> vat.validate('GD100') # government department 'GD100' >>> vat.validate('HA501') # health authority 'HA501' +>>> vat.validate('GD888810003') # government department for EU +'GD888810003' +>>> vat.validate('HA888856782') # health authority for EU +'HA888856782' Invalid long numbers: @@ -51,6 +57,14 @@ InvalidLength: ... Traceback (most recent call last): ... InvalidFormat: ... +>>> vat.validate('GD8888567B2') # invalid digit for EU health authority +Traceback (most recent call last): + ... +InvalidFormat: ... +>>> vat.validate('001234567') # invalid checksum +Traceback (most recent call last): + ... +InvalidChecksum: ... Some variations on the short format: @@ -69,6 +83,22 @@ Traceback (most recent call last): InvalidComponent: ... +Some variations on the EU format: + +>>> vat.validate('GD888860018') # government department with high number +Traceback (most recent call last): + ... +InvalidComponent: ... +>>> vat.validate('HA888820107') # health authority with low number +Traceback (most recent call last): + ... +InvalidComponent: ... +>>> vat.validate('HA888856700') # health authority with invalid checksum +Traceback (most recent call last): + ... +InvalidChecksum: ... + + Formatting tests: >>> vat.format('980780684') # standard number |