-
Notifications
You must be signed in to change notification settings - Fork 221
Expand file tree
/
Copy pathtest_zm_tpin.doctest
More file actions
63 lines (50 loc) · 1.65 KB
/
test_zm_tpin.doctest
File metadata and controls
63 lines (50 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
test_zm_tpin.doctest - more detailed doctests for stdnum.zm.tpin module
Copyright (C) 2023 Leandro Regueiro
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
This file contains more detailed doctests for the stdnum.zm.tpin module. It
tries to test more corner cases and detailed functionality that is not really
useful as module documentation.
>>> from stdnum.zm import tpin
Tests for some corner cases.
>>> tpin.validate('1001788854')
'1001788854'
>>> tpin.validate('12345')
Traceback (most recent call last):
...
InvalidLength: ...
>>> tpin.validate('VV34567890')
Traceback (most recent call last):
...
InvalidFormat: ...
>>> tpin.format('1001788854')
'1001788854'
These have been found online and should all be valid numbers.
>>> numbers = '''
...
... 1001788854
... 1002198166
... 1001998819
... 2991788603
... 1002188228
... 1006160651
... 1002327663
... 1002503851
... 1003661603
... 1001710408
... 1002169843
... 1001218594
...
... '''
>>> [x for x in numbers.splitlines() if x and not tpin.is_valid(x)]
[]