test_ar_cuit.doctest - more detailed doctests for the stdnum.ac.cuit module

Copyright (C) 2015 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.ac.cuit module. It
tries to validate a number of numbers that have been found online.

>>> from stdnum.ar import cuit
>>> from stdnum.exceptions import *


Test some corner cases.

>>> cuit.validate('20-05536168-2')
'20055361682'
>>> cuit.validate('2026756539')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> cuit.validate('2026756A393')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> cuit.validate('99-05536168-8')
Traceback (most recent call last):
    ...
InvalidComponent: ...


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

>>> numbers = '''
...
... 20-10123456-9
... 20040356437
... 20047433747
... 20050573452
... 20054613009
... 20058481425
... 20058723410
... 20058879089
... 20073562954
... 20073659486
... 20076084735
... 20077530127
... 20081042404
... 20086295106
... 20086607043
... 20101234569
... 20101376630
... 20102289855
... 20103055475
... 20105567643
... 20108146304
... 20108524244
... 20108909170
... 20110831243
... 20112806440
... 20113951517
... 20120774019
... 20121388570
... 20125491783
... 20128032801
... 20129599058
... 20131707992
... 20132002755
... 20136310136
... 20143455905
... 20144779674
... 20145053294
... 20146234306
... 20171104042
... 20171823960
... 20182886530
... 20184230446
... 20187687137
... 20202569456
... 20203954795
... 20204393363
... 20205752766
... 20209954088
... 20213601785
... 20220030165
... 20223730907
... 20224293578
... 20225121169
... 20227716011
... 20237525613
... 20238697752
... 20245079541
... 20248651793
... 20250926155
... 20255761367
... 20259636117
... 20261576393
... 20262358977
... 20271280344
... 20272201588
... 20275121364
... 20282423910
... 20283621759
... 20285115664
... 20287747722
... 20290072981
... 20293386162
... 20298479932
... 20300953655
... 20305216950
... 20314469616
... 20314970951
... 20319011987
... 20320639361
... 20321768165
... 20323118249
... 20324215809
... 20324381709
... 20324794043
... 20328504708
... 20344135763
... 20344379131
... 20347620204
... 20354205271
... 20355854974
... 20360612679
... 20373308359
... 20922078182
... 20922312401
... 20929597916
... 23000052264
... 23042708194
... 23045174999
... 23081181489
... 23102532279
... 23161822434
... 23175636404
... 23214238519
... 23233647969
... 23244989004
... 23270774199
... 23278857069
... 23279103009
... 23314669649
... 23324786244
... 23334052729
... 23338909764
... 23355601684
... 23935319099
... 24117166062
... 24276145513
... 27-10345678-4
... 27018259899
... 27023396861
... 27032487705
... 27056528240
... 27057490638
... 27060695488
... 27063049366
... 27066515678
... 27066595485
... 27098767849
... 27103456784
... 27107931738
... 27114547382
... 27121262059
... 27122342420
... 27127539923
... 27130430142
... 27134454569
... 27172336472
... 27173495094
... 27175432812
... 27177192010
... 27177721994
... 27179361642
... 27180795672
... 27185685298
... 27201493841
... 27205913209
... 27215060417
... 27216654523
... 27216824178
... 27221319619
... 27232710921
... 27234685568
... 27243584871
... 27245896609
... 27247110831
... 27248949770
... 27250076679
... 27259106430
... 27259522078
... 27261420215
... 27262935081
... 27267742249
... 27273160103
... 27276663084
... 27278570601
... 27279026271
... 27281657025
... 27283110546
... 27284491675
... 27284753505
... 27288128389
... 27296108591
... 27303521211
... 27304599451
... 27310947828
... 27312481389
... 27314396036
... 27316481677
... 27335804088
... 27354548165
... 27366029902
... 27366146259
... 27372855350
... 27373316690
... 27937240444
... 27938621395
... 27940212664
... 27949019387
... 30011111110
... 30653311857
... 30670349760
... 30691769336
... 30700596210
... 30710422636
... 30710916574
... 30711016046
... 30711067074
... 30711271003
... 30711683166
... 30712071199
... 30712417419
... 30714322296
... 30714468088
... 30714789062
... 33500001599
... 33534828379
... 33708972679
... 33712308589
... 33714423709
... 34546198105
...
... '''
>>> [x for x in numbers.splitlines() if x and not cuit.is_valid(x)]
[]