test_kr_brn.doctest - more detailed doctests for stdnum.kr.brn module

Copyright (C) 2020 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.kr.brn module. It
tries to test more corner cases and detailed functionality that is not really
useful as module documentation.

>>> from stdnum.kr import brn


Tests for some corner cases.

>>> brn.validate('2098206382')
'2098206382'
>>> brn.validate('211-86-08983')
'2118608983'
>>> brn.validate('317 - 81 - 11175')
'3178111175'
>>> brn.validate('220 88 69974')
'2208869974'
>>> brn.format('1304717700')
'130-47-17700'
>>> brn.validate('80123456785')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> brn.validate('FF34567890')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> brn.validate('100-86-08983')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> brn.validate('211-00-08983')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> brn.validate('211-86-00003')
Traceback (most recent call last):
    ...
InvalidComponent: ...


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

>>> numbers = '''
...
... 101-82-13065
... 102-81-03525
... 102-81-42945
... 104-81-25258
... 104-81-36565
... 104-84-03406
... 105-17-41513
... 105-86-61489
... 106-82-07200
... 107-82-09351
... 107-87-13471
... 107-87-70962
... 108-19-83613
... 109-81-33637
... 109-81-39795
... 109-81-62393
... 110-12-39727
... 110-14-16596
... 110-81-05034
... 110-81-07390
... 110-81-40725
... 110-84-02173
... 112-81-30811
... 113-02-43949
... 113-81-92367
... 113-85-26486
... 113-86-21886
... 113-86-38602
... 113-86-46500
... 113-86-60856
... 114-81-44645
... 114-82-62150
... 114-86-00579
... 114-86-04968
... 114-86-61464
... 116-82-00276
... 117-81-77714
... 118-81-09714
... 119-02-43947
... 119-19-96781
... 119-82-08146
... 119-82-63265
... 119-86-44529
... 119-86-79111
... 119-87-08063
... 120-81-57465
... 120-86-39706
... 1208200052
... 121-81-25326
... 121-81-42209
... 121-81-78347
... 122-81-62455
... 124-81-79802
... 124-86-13144
... 124-86-65341
... 124-86-85333
... 127-11-87351
... 128-02-41206
... 128-39-49844
... 128-81-63302
... 128-81-77295
... 129-81-16573
... 129-81-23356
... 129-81-30691
... 129-81-85385
... 129-86-38970
... 129-86-39907
... 130-47-17700
... 130-81-92528
... 130-86-35857
... 130-86-79710
... 130-86-89294
... 131-82-00372
... 131-86-40843
... 132-81-38608
... 132-86-04520
... 133-81-29441
... 133-81-32077
... 133-81-40621
... 134-81-06679
... 134-86-24634
... 134-86-44004
... 134-86-72683
... 135-09-24640
... 135-29-80067
... 135-81-06333
... 137-86-39058
... 138-81-03499
... 138-81-44092
... 138-81-44277
... 140-81-67744
... 141-81-18585
... 143-81-10463
... 144-81-25090
... 148-05-00404
... 156-23-00883
... 169-86-00394
... 183-98-00113
... 187-82-00055
... 193-86-00010
... 201-81-54845
... 201-81-76228
... 201-81-99798
... 201-85-17396
... 201-86-25781
... 202-81-04367
... 202-81-42420
... 204-06-91556
... 204-86-46427
... 205-81-26341
... 206-18-12345
... 206-86-50913
... 208-81-24115
... 209-82-05326
... 209-82-06382
... 211-86-08983
... 211-86-23306
... 211-86-39754
... 211-87-67960
... 214-11-58465
... 214-81-04230
... 214-87-78980
... 214-87-98889
... 214-87-99743
... 214-88-49333
... 214-88-51159
... 215-87-86862
... 217-81-14493
... 219-01-39810
... 220 88 69974
... 220-81-66148
... 220-81-83676
... 220-82-05060
... 220-87-18070
... 220-87-57205
... 220-88-75699
... 220-88-88699
... 221-81-32210
... 221-83-01195
... 222-81-03192
... 224-81-41168
... 231-81-02896
... 275-87-01259
... 279-81-01263
... 280-86-01410
... 301-81-14992
... 301-81-91475
... 301-82-62166
... 301-86-12266
... 303-12-73313
... 303-81-44911
... 303-82-07378
... 305-81-38564
... 305-81-70638
... 305-81-87876
... 306-81-22629
... 306-82-00417
... 308-81-41001
... 311-81-22413
... 312-12-25168
... 312-30-06675
... 312-81-95317
... 314-81-25684
... 314-82-01980
... 314-86-00956
... 314-86-42432
... 314-86-53230
... 314-86-63209
... 317 - 81 - 11175
... 317-81-04543
... 318-81-02096
... 321-81-00982
... 348-13-00692
... 364-81-00669
... 374-81-01516
... 375-10-00859
... 375-88-00519
... 383-37-00143
... 394-92-00410
... 398-85-00113
... 402-82-15272
... 409-86-33769
... 410-25-53731
... 410-82-83844
... 410-86-53770
... 415-06-83258
... 415-81-19511
... 415-82-11025
... 416-81-48042
... 417-85-07912
... 420-87-00883
... 501-26-78904
... 503-86-09407
... 504-81-85233
... 504-85-11802
... 506-82-06755
... 514-81-68599
... 515-04-62016
... 515-05-32580
... 515-07-68272
... 515-81-10315
... 515-81-40648
... 533-85-00526
... 533-87-01306
... 568-41-00305
... 580-21-00836
... 582-90-00497
... 602-81-66559
... 603-81-24270
... 606-81-54507
... 606-86-06989
... 609-81-99124
... 610-09-84339
... 610-81-04971
... 615-82-11718
... 615-86-09068
... 616-24-46281
... 616-25-12643
... 617-86-11575
... 621-15-41743
... 632-11-01006
... 639-86-00985
... 649-82-00117
... 669-81-00996
... 680-87-00210
... 682-85-00885
... 728-86-00316
... 735-85-00501
... 760-06-00079
... 766-88-00563
... 782-86-00130
... 809-81-01574
... 816-81-00840
... 884-17-01026
...
... '''
>>> [x for x in numbers.splitlines() if x and not brn.is_valid(x)]
[]