Skip to content

Commit fcd4dd1

Browse files
authored
fix: garmany personal tin number separators removed (#45)
Garmany personal tin number shouldn't have any separators.
1 parent c142cf5 commit fcd4dd1

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

stdnum/de/idnr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@
5353

5454

5555
def compact(number):
56-
"""Convert the number to the minimal representation. This strips the
57-
number of any valid separators and removes surrounding whitespace."""
58-
return clean(number, ' -./,').strip()
56+
"""Convert the number to the minimal representation. It shouldn't have any separators."""
57+
return clean(number, '').strip()
5958

6059

6160
def validate(number):

tests/test_de_idnr.doctest

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,39 @@ start with a zero.
3232
>>> idnr.validate('116574261809')
3333
Traceback (most recent call last):
3434
...
35-
InvalidLength: ...
35+
stdnum.exceptions.InvalidLength: The number has an invalid length.
3636
>>> idnr.validate('A6574261809')
3737
Traceback (most recent call last):
3838
...
39-
InvalidFormat: ...
39+
stdnum.exceptions.InvalidFormat: The number has an invalid format.
4040
>>> idnr.validate('01234567896')
4141
Traceback (most recent call last):
4242
...
43-
InvalidFormat: ...
43+
stdnum.exceptions.InvalidFormat: The number has an invalid format.
4444

4545

4646
The first 10 digits of the IdNr is supposed to contain exactly one digit
4747
twice (or three times since 2016) and all other digits in the number can only
4848
appear once. This tries to catch some corner cases. Note that only the first
4949
10 digits are considered for this.
5050

51-
>>> idnr.validate('1234567890 3') # each digit once
51+
>>> idnr.validate('12345678903') # each digit once
5252
Traceback (most recent call last):
5353
...
54-
InvalidFormat: ...
55-
>>> idnr.validate('1123456789 0') # one digit twice
54+
stdnum.exceptions.InvalidFormat: The number has an invalid format.
55+
>>> idnr.validate('11234567890') # one digit twice
5656
'11234567890'
57-
>>> idnr.validate('1112345678 6') # one digit three times
57+
>>> idnr.validate('11123456786') # one digit three times
5858
'11123456786'
59+
>>> idnr.validate('1112345678 6') # one digit three times
60+
Traceback (most recent call last):
61+
...
62+
stdnum.exceptions.InvalidLength: The number has an invalid length.
5963
>>> idnr.validate('1111234567 8') # one digit four times
6064
Traceback (most recent call last):
6165
...
62-
InvalidFormat: ...
66+
stdnum.exceptions.InvalidLength: The number has an invalid length.
6367
>>> idnr.validate('1122345678 5') # two digits more than once
6468
Traceback (most recent call last):
6569
...
66-
InvalidFormat: ...
70+
stdnum.exceptions.InvalidLength: The number has an invalid length.

0 commit comments

Comments
 (0)