Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/tests/test_gr_amka.doctest
blob: 6b8815f667d5a57b0114851b73247df70d99f2d6 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
test_gr_amka.doctest - more detailed doctests for stdnum.gr.amka module

Copyright (C) 2019 Arthur de Jong

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.gr.amka module. It
tries to test more corner cases and detailed functionality that is not really
useful as module documentation.

>>> from stdnum.gr import amka


Tests for some corner cases.

>>> amka.get_gender('01014719866')
'F'
>>> amka.get_birth_date('29020012349')  # the year 1900 wasn't a leap year
datetime.date(2000, 2, 29)
>>> amka.get_birth_date('99887712349')
Traceback (most recent call last):
    ...
InvalidComponent: ...


These have been found online and should all be valid numbers.

>>> numbers = '''
...
... 01015734500
... 01017902501
... 01037200308
... 01086004429
... 01086104112
... 01115904128
... 02027000252
... 02037500945
... 02065702405
... 03016601845
... 03026603674
... 03037202441
... 03076103047
... 03106501681
... 03117200869
... 04087402360
... 04116301831
... 05086500989
... 06067504867
... 06097603465
... 06105502253
... 07017100129
... 07018502224
... 07106303022
... 07107300886
... 08016701602
... 08017702609
... 08017704126
... 08036603580
... 08116303002
... 08117501117
... 09106001291
... 09116602260
... 10026004050
... 10047602601
... 10096900187
... 11014803107
... 11016400969
... 11025702967
... 11046703861
... 12047200899
... 12105704402
... 13077802109
... 13096701340
... 13125502677
... 14025500902
... 14046001336
... 14066303158
... 14067000407
... 15017306430
... 16016804169
... 16056702307
... 16077801260
... 17025100797
... 17116903224
... 18025400765
... 18058302342
... 19017803057
... 19025503111
... 19055702252
... 19076801638
... 20017802123
... 20035603156
... 20036305348
... 20057401257
... 21028001986
... 21086800642
... 21117500724
... 22016501151
... 22027901325
... 22065701165
... 22105800084
... 23096100682
... 24047005699
... 24086202793
... 25036505284
... 25047902066
... 25088700387
... 25098700203
... 25125700721
... 26107300183
... 26126301089
... 27056500807
... 27065801162
... 27087200989
... 27116400865
... 27126702243
... 28036104546
... 28057902661
... 28087800729
... 28096101861
... 28126002196
... 29095401419
... 30046801046
... 30067201225
... 30096101065
... 30126002077
... 31035902076
... 31057004512
... 31085501570
...
... '''
>>> [x for x in numbers.splitlines() if x and not amka.is_valid(x)]
[]