lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.11-24-g510a46a

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.11-24-g510a46a



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  510a46a8e8d08aa2f9464c6dfd086c3af80d03ce (commit)
       via  4b10f56506ae58b586f56650c620194ecf15d291 (commit)
       via  d0da884e1c02c7b21d9010a268866a984518326c (commit)
      from  1e814cea8d86d0b69a5fbb5b5107036e4fd6b119 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=510a46a8e8d08aa2f9464c6dfd086c3af80d03ce

commit 510a46a8e8d08aa2f9464c6dfd086c3af80d03ce
Author: Leandro Regueiro <leandro.regueiro@gmail.com>
Date:   Sat Jun 15 21:05:15 2019 +0200

    Add Costa Rica foreigners identification number
    
    Part of https://github.com/arthurdejong/python-stdnum/issues/141
    Closes https://github.com/arthurdejong/python-stdnum/pull/140

diff --git a/stdnum/cr/cr.py b/stdnum/cr/cr.py
new file mode 100644
index 0000000..a63e414
--- /dev/null
+++ b/stdnum/cr/cr.py
@@ -0,0 +1,92 @@
+# cr.py - functions for handling Costa Rica DIMEX numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+
+"""CR (Cédula de Residencia, Costa Rica foreigners ID number).
+
+The Cédula de Residencia (CR), also know as DIMEX or Documento de
+Identificación Migratorio para Extranjeros, is an identifier of foreigners in
+Costa Rica.
+
+This number consists of 11 or 12 digits in the form 1NNN-CC...C-EE...E where
+NNN represents the code of the country the foreigner comes from as specified
+by Costa Rica's Dirección General de Migración y Extranjería, CC...C is a
+sequence telling how many Cédula de Residencia have been issued in total and
+EE...E is a sequence telling how many Cédula de Residencia have been issued
+for that particular foreign country.
+
+More information:
+
+* https://www.hacienda.go.cr/consultapagos/ayuda_cedulas.htm
+* https://www.procomer.com/downloads/quiero/guia_solicitud_vuce.pdf (page 12)
+* https://www.hacienda.go.cr/ATV/frmConsultaSituTributaria.aspx
+
+>>> validate('155812994816')
+'155812994816'
+>>> validate('30123456789')
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> validate('12345678')
+Traceback (most recent call last):
+    ...
+InvalidLength: ...
+>>> format('122200569906')
+'122200569906'
+"""
+
+from stdnum.exceptions import *
+from stdnum.util import clean, isdigits
+
+
+def compact(number):
+    """Convert the number to the minimal representation.
+
+    This strips the number of any valid separators and removes surrounding
+    whitespace.
+    """
+    return clean(number, ' -').upper().strip()
+
+
+def validate(number):
+    """Check if the number is a valid Costa Rica CR number.
+
+    This checks the length and formatting.
+    """
+    number = compact(number)
+    if len(number) not in (11, 12):
+        raise InvalidLength()
+    if not isdigits(number):
+        raise InvalidFormat()
+    if number[0] != '1':
+        raise InvalidComponent()
+    return number
+
+
+def is_valid(number):
+    """Check if the number is a valid Costa Rica CR number."""
+    try:
+        return bool(validate(number))
+    except ValidationError:
+        return False
+
+
+def format(number):
+    """Reformat the number to the standard presentation format."""
+    return compact(number)
diff --git a/tests/test_cr_cr.doctest b/tests/test_cr_cr.doctest
new file mode 100644
index 0000000..138f9b3
--- /dev/null
+++ b/tests/test_cr_cr.doctest
@@ -0,0 +1,71 @@
+test_cr_cr.doctest - more detailed doctests for stdnum.cr.cr module
+
+Copyright (C) 2019 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.cr.cr module. It
+tries to test more corner cases and detailed functionality that is not really
+useful as module documentation.
+
+>>> from stdnum.cr import cr
+
+
+Tests for some corner cases.
+
+>>> cr.validate('155812994816')
+'155812994816'
+>>> cr.validate('172400024706')
+'172400024706'
+>>> cr.validate('10123456789')
+'10123456789'
+>>> cr.format('122200569906')
+'122200569906'
+>>> cr.validate('12345678')
+Traceback (most recent call last):
+    ...
+InvalidLength: ...
+>>> cr.validate('FF0123456789')
+Traceback (most recent call last):
+    ...
+InvalidFormat: ...
+>>> cr.validate('30123456789')  # Invalid first digit
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 155812994816
+... 172400024706
+... 184000074805
+... 117001702423
+... 186200114917
+... 117000679620
+... 172400118430
+... 117000809436
+... 122200569906
+... 117000679727
+... 117001139718
+... 184000033224
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not cr.is_valid(x)]
+[]

https://arthurdejong.org/git/python-stdnum/commit/?id=4b10f56506ae58b586f56650c620194ecf15d291

commit 4b10f56506ae58b586f56650c620194ecf15d291
Author: Leandro Regueiro <leandro.regueiro@gmail.com>
Date:   Sat Jun 15 20:28:14 2019 +0200

    Add Costa Rica Cédula de Identidad
    
    Closes https://github.com/arthurdejong/python-stdnum/issues/139

diff --git a/stdnum/cr/cpf.py b/stdnum/cr/cpf.py
new file mode 100644
index 0000000..105a0e1
--- /dev/null
+++ b/stdnum/cr/cpf.py
@@ -0,0 +1,105 @@
+# cpf.py - functions for handling Costa Rica CPF numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+
+"""CPF (Cédula de Persona Física, Costa Rica physical person ID number).
+
+The Cédula de Persona Física (CPF), also known as Cédula de Identidad is an
+identifier of physical persons.
+
+The number consists of 10 digits in the form 0P-TTTT-AAAA where P represents
+the province, TTTT represents the volume (tomo) padded with zeroes on the
+left, and AAAA represents the entry (asiento) also padded with zeroes on the
+left.
+
+It seems to be usual for the leading zeroes in each of the three parts to be
+omitted.
+
+More information:
+
+* https://www.hacienda.go.cr/consultapagos/ayuda_cedulas.htm
+* https://www.procomer.com/downloads/quiero/guia_solicitud_vuce.pdf (page 11)
+* https://www.hacienda.go.cr/ATV/frmConsultaSituTributaria.aspx
+
+>>> validate('3-0455-0175')
+'0304550175'
+>>> validate('30-1234-1234')
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> validate('12345678')
+Traceback (most recent call last):
+    ...
+InvalidLength: ...
+>>> format('701610395')
+'07-0161-0395'
+>>> format('1-613-584')
+'01-0613-0584'
+"""
+
+from stdnum.exceptions import *
+from stdnum.util import clean, isdigits
+
+
+def compact(number):
+    """Convert the number to the minimal representation.
+
+    This strips the number of any valid separators and removes surrounding
+    whitespace. Also adds padding zeroes if necessary.
+    """
+    number = clean(number, ' ').upper().strip()
+    parts = number.split('-')
+    if len(parts) == 3:
+        # Pad each group with zeroes
+        parts[0] = '0' * (2 - len(parts[0])) + parts[0]
+        parts[1] = '0' * (4 - len(parts[1])) + parts[1]
+        parts[2] = '0' * (4 - len(parts[2])) + parts[2]
+    number = ''.join(parts)
+    if len(number) == 9:
+        number = '0' + number  # Add leading zero
+    return number
+
+
+def validate(number):
+    """Check if the number is a valid Costa Rica CPF number.
+
+    This checks the length and formatting.
+    """
+    number = compact(number)
+    if len(number) != 10:
+        raise InvalidLength()
+    if not isdigits(number):
+        raise InvalidFormat()
+    if number[0] != '0':
+        raise InvalidComponent()
+    return number
+
+
+def is_valid(number):
+    """Check if the number is a valid Costa Rica CPF number."""
+    try:
+        return bool(validate(number))
+    except ValidationError:
+        return False
+
+
+def format(number):
+    """Reformat the number to the standard presentation format."""
+    number = compact(number)
+    return '-'.join([number[:2], number[2:6], number[6:]])
diff --git a/tests/test_cr_cpf.doctest b/tests/test_cr_cpf.doctest
new file mode 100644
index 0000000..ee4d730
--- /dev/null
+++ b/tests/test_cr_cpf.doctest
@@ -0,0 +1,207 @@
+test_cr_cpf.doctest - more detailed doctests for stdnum.cr.cpf module
+
+Copyright (C) 2019 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.cr.cpf module. It
+tries to test more corner cases and detailed functionality that is not really
+useful as module documentation.
+
+>>> from stdnum.cr import cpf
+
+
+Tests for some corner cases.
+
+>>> cpf.validate('3-0455-0175')
+'0304550175'
+>>> cpf.validate('8-0074-0308')
+'0800740308'
+>>> cpf.format('701610395')
+'07-0161-0395'
+>>> cpf.format('1-613-584')
+'01-0613-0584'
+>>> cpf.validate('12345678')
+Traceback (most recent call last):
+    ...
+InvalidLength: ...
+>>> cpf.validate('FF8490717')
+Traceback (most recent call last):
+    ...
+InvalidFormat: ...
+>>> cpf.validate('30-1234-1234')  # Invalid first digit.
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 01-0913-0259
+... 1-0054-1023
+... 1-0087-1407
+... 1-0150-0837
+... 1-0228-0776
+... 1-0278-0527
+... 1-0316-0324
+... 1-0332-0133
+... 1-0390-0960
+... 1-0407-0888
+... 1-0415-1184
+... 1-0421-0836
+... 1-0466-0156
+... 1-0498-0195
+... 1-0531-0384
+... 1-0532-0390
+... 1-0534-0078
+... 1-0545-0822
+... 1-0562-0101
+... 1-0591-0262
+... 1-0626-0764
+... 1-0628-0541
+... 1-0639-0110
+... 1-0657-0789
+... 1-0708-0466
+... 1-0725-0910
+... 1-0726-0670
+... 1-0803-0197
+... 1-0886-0147
+... 1-0912-0931
+... 1-0913-0259
+... 1-0928-0281
+... 1-0968-0428
+... 1-1001-0442
+... 1-1014-0042
+... 1-1054-0017
+... 1-1067-0418
+... 1-1087-0407
+... 1-1089-0198
+... 1-1096-0837
+... 1-1120-0579
+... 1-1134-0838
+... 1-1157-0794
+... 1-1295-0637
+... 1-1359-0010
+... 1-1366-0691
+... 1-1394-0644
+... 1-1433-0557
+... 1-1459-0511
+... 1-1476-0148
+... 1-200-589
+... 1-329-571
+... 1-535-896
+... 1-613-584
+... 104001311
+... 104800996
+... 105250568
+... 105580219
+... 106220930
+... 106690228
+... 107340512
+... 107560893
+... 107580405
+... 107580660
+... 107880621
+... 108120604
+... 108330923
+... 108490717
+... 108920872
+... 109080006
+... 109120931
+... 109130188
+... 109260105
+... 109300285
+... 109520663
+... 109720105
+... 109840695
+... 110090302
+... 110180975
+... 110410825
+... 110650272
+... 110660601
+... 110800656
+... 110870061
+... 110900985
+... 111090412
+... 111390272
+... 112090212
+... 112110723
+... 112380589
+... 112640423
+... 113220734
+... 113640299
+... 113860743
+... 113940979
+... 114010385
+... 114580221
+... 114930949
+... 115420027
+... 2-0245-0445
+... 2-0432-0316
+... 2-0449-0150
+... 2-0450-0764
+... 2-2587-0407
+... 203040464
+... 203250032
+... 204260049
+... 206880078
+... 3-0150-0598
+... 3-0217-0344
+... 3-0399-0707
+... 3-0455-0175
+... 3-0476-0087
+... 302270170
+... 303340875
+... 303760289
+... 4-0104-0893
+... 4-0160-182
+... 400421003
+... 401280185
+... 401280825
+... 5-0137-0841
+... 5-0244-0212
+... 5-0274-0313
+... 5-0392-0395
+... 502490573
+... 503560283
+... 504080862
+... 6-0084-0857
+... 6-0123-0852
+... 6-0239-0996
+... 6-0378-0273
+... 6-0392-0190
+... 601180041
+... 602180714
+... 602550924
+... 700510665
+... 701610395
+... 8-0063-0991
+... 8-0074-0308
+... 8-0091-0532
+... 8-0092-0491
+... 800760308
+... 801140175
+... 9-0024-0173
+... 9-0024-0427
+... 9-0094-0363
+... 900740903
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not cpf.is_valid(x)]
+[]

https://arthurdejong.org/git/python-stdnum/commit/?id=d0da884e1c02c7b21d9010a268866a984518326c

commit d0da884e1c02c7b21d9010a268866a984518326c
Author: Leandro Regueiro <leandro.regueiro@gmail.com>
Date:   Sat Jun 15 17:52:25 2019 +0200

    Add Costa Rica TIN number
    
    Closes https://github.com/arthurdejong/python-stdnum/issues/109

diff --git a/stdnum/cr/__init__.py b/stdnum/cr/__init__.py
new file mode 100644
index 0000000..5718342
--- /dev/null
+++ b/stdnum/cr/__init__.py
@@ -0,0 +1,21 @@
+# __init__.py - collection of Costa Rican numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+
+"""Collection of Costa Rican numbers."""
diff --git a/stdnum/cr/cpj.py b/stdnum/cr/cpj.py
new file mode 100644
index 0000000..c713a85
--- /dev/null
+++ b/stdnum/cr/cpj.py
@@ -0,0 +1,103 @@
+# cpj.py - functions for handling Costa Rica CPJ numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+
+"""CPJ (Cédula de Persona Jurídica, Costa Rica tax number).
+
+The Cédula de Persona Jurídica (CPJ) is an identifier of legal entities for
+tax purposes.
+
+This number consists of 10 digits, the first indicates the class of juridical
+person, followed by a 3 digit sequence number identifying the type of
+juridical person, followed by 6 digits sequence number assigned by Registro
+Nacional de la República de Costa Rica.
+
+More information:
+
+* https://www.hacienda.go.cr/consultapagos/ayuda_cedulas.htm
+* https://www.procomer.com/downloads/quiero/guia_solicitud_vuce.pdf (page 11)
+* 
http://www.registronacional.go.cr/personas_juridicas/documentos/Consultas/Listado%20de%20Clases%20y%20Tipos%20Cedulas%20Juridicas.pdf
+* https://www.hacienda.go.cr/ATV/frmConsultaSituTributaria.aspx
+
+>>> validate('3-101-999999')
+'3101999999'
+>>> validate('3-534-123559')
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> validate('310132541')
+Traceback (most recent call last):
+    ...
+InvalidLength: ...
+>>> format('4 000 042138')
+'4-000-042138'
+"""
+
+from stdnum.exceptions import *
+from stdnum.util import clean, isdigits
+
+
+def compact(number):
+    """Convert the number to the minimal representation.
+
+    This strips the number of any valid separators and removes surrounding
+    whitespace.
+    """
+    return clean(number, ' -').upper().strip()
+
+
+def validate(number):
+    """Check if the number is a valid Costa Rica CPJ number.
+
+    This checks the length and formatting.
+    """
+    number = compact(number)
+    if len(number) != 10:
+        raise InvalidLength()
+    if not isdigits(number):
+        raise InvalidFormat()
+    if number[0] not in ('2', '3', '4', '5'):
+        raise InvalidComponent()
+    if number[0] == '2' and number[1:4] not in ('100', '200', '300', '400'):
+        raise InvalidComponent()
+    class_three_types = ('002', '003', '004', '005', '006', '007', '008',
+                         '009', '010', '011', '012', '013', '014', '101',
+                         '102', '103', '104', '105', '106', '107', '108',
+                         '109', '110')
+    if number[0] == '3' and number[1:4] not in class_three_types:
+        raise InvalidComponent()
+    if number[0] == '4' and number[1:4] != '000':
+        raise InvalidComponent()
+    if number[0] == '5' and number[1:4] != '001':
+        raise InvalidComponent()
+    return number
+
+
+def is_valid(number):
+    """Check if the number is a valid Costa Rica CPJ number."""
+    try:
+        return bool(validate(number))
+    except ValidationError:
+        return False
+
+
+def format(number):
+    """Reformat the number to the standard presentation format."""
+    number = compact(number)
+    return '-'.join([number[0], number[1:4], number[4:]])
diff --git a/tests/test_cr_cpj.doctest b/tests/test_cr_cpj.doctest
new file mode 100644
index 0000000..d77ff67
--- /dev/null
+++ b/tests/test_cr_cpj.doctest
@@ -0,0 +1,275 @@
+test_cr_cpj.doctest - more detailed doctests for stdnum.cr.cpj module
+
+Copyright (C) 2019 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.cr.cpj module. It
+tries to test more corner cases and detailed functionality that is not really
+useful as module documentation.
+
+>>> from stdnum.cr import cpj
+
+
+Tests for some corner cases.
+
+>>> cpj.validate('3-101-999999')
+'3101999999'
+>>> cpj.validate('3 010 179406')
+'3010179406'
+>>> cpj.validate('3-101-121231')
+'3101121231'
+>>> cpj.format('3101015462')
+'3-101-015462'
+>>> cpj.validate('3-102-10536')
+Traceback (most recent call last):
+    ...
+InvalidLength: ...
+>>> cpj.validate('3-102-ABCDEF')
+Traceback (most recent call last):
+    ...
+InvalidFormat: ...
+>>> cpj.validate('1-101-079297')  # Invalid class (first digit)
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> cpj.validate('2-511-079297')  # Invalid type (digits 2, 3, 4) for class 2
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> cpj.validate('3-121-176017')  # Invalid type for class 3
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> cpj.validate('4-001-123456')  # Invalid type for class 4
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> cpj.validate('5-000-123456')  # Invalid type for class 5
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 2-100-042002
+... 2-200-042153
+... 2-300-042155
+... 2-400-042156
+... 3 010 179406
+... 3-002-045556
+... 3-002-670350
+... 3-003-051878
+... 3-003-066718
+... 3-004-481707
+... 3-005-045142
+... 3-006-087315
+... 3-006-227840
+... 3-007-317912
+... 3-007-655746
+... 3-008-218945
+... 3-009-045021
+... 3-009-117444
+... 3-010-045209
+... 3-010-418099
+... 3-011-051123
+... 3-011-111229
+... 3-012-000585
+... 3-012-629125
+... 3-012-631203
+... 3-012-659212
+... 3-012-682004
+... 3-012-702749
+... 3-013-337748
+... 3-013-468741
+... 3-014-042088
+... 3-014-042116
+... 3-101-000046
+... 3-101-180014
+... 3-101-230903
+... 3-101-232523
+... 3-101-232928
+... 3-101-236840
+... 3-101-237754
+... 3-101-240266
+... 3-101-240940
+... 3-101-245331
+... 3-101-245508
+... 3-101-247096
+... 3-101-247476
+... 3-101-249874
+... 3-101-250372
+... 3-101-252630
+... 3-101-256279
+... 3-101-256760
+... 3-101-259465
+... 3-101-259663
+... 3-101-259674
+... 3-101-260767
+... 3-101-262681
+... 3-101-263222
+... 3-101-263317
+... 3-101-263799
+... 3-101-263976
+... 3-101-266555
+... 3-101-267388
+... 3-101-267648
+... 3-101-274629
+... 3-101-274881
+... 3-101-275421
+... 3-101-278412
+... 3-101-279147
+... 3-101-279791
+... 3-101-280790
+... 3-101-282414
+... 3-101-282787
+... 3-101-285061
+... 3-101-287067
+... 3-101-289334
+... 3-101-290860
+... 3-101-292498
+... 3-101-293230
+... 3-101-294732
+... 3-101-295808
+... 3-101-296082
+... 3-101-296856
+... 3-101-301495
+... 3-101-304441
+... 3-101-304550
+... 3-101-305224
+... 3-101-305227
+... 3-101-306858
+... 3-101-308183
+... 3-101-316152
+... 3-101-318274
+... 3-101-319136
+... 3-101-319175
+... 3-101-319275
+... 3-101-320716
+... 3-101-321702
+... 3-101-322639
+... 3-101-323383
+... 3-101-325528
+... 3-101-328708
+... 3-101-328989
+... 3-101-329524
+... 3-101-332402
+... 3-101-332724
+... 3-101-333084
+... 3-101-333318
+... 3-101-333545
+... 3-101-334264
+... 3-101-334668
+... 3-101-334968
+... 3-101-335191
+... 3-101-335649
+... 3-101-338742
+... 3-101-338884
+... 3-101-340184
+... 3-101-340254
+... 3-101-341854
+... 3-101-341966
+... 3-101-342669
+... 3-101-344336
+... 3-101-347395
+... 3-101-349806
+... 3-101-350808
+... 3-101-351360
+... 3-101-351794
+... 3-101-351901
+... 3-101-352094
+... 3-101-355875
+... 3-101-357417
+... 3-101-357679
+... 3-101-357705
+... 3-101-358300
+... 3-101-359999
+... 3-101-360891
+... 3-101-366653
+... 3-101-368803
+... 3-101-370997
+... 3-101-372304
+... 3-101-380046
+... 3-101-380490
+... 3-101-381068
+... 3-101-381976
+... 3-101-385240
+... 3-101-386582
+... 3-101-386705
+... 3-101-387699
+... 3-101-398343
+... 3-101-398763
+... 3-101-400625
+... 3-101-405354
+... 3-101-405407
+... 3-101-756187
+... 3-102-010536
+... 3-102-231503
+... 3-102-272341
+... 3-102-295219
+... 3-102-323641
+... 3-102-331885
+... 3-102-362027
+... 3-102-379487
+... 3-102-388142
+... 3-102-400049
+... 3-102-402340
+... 3-102-435843
+... 3-102-444529
+... 3-102-465883
+... 3-102-468787
+... 3-102-488653
+... 3-102-493190
+... 3-102-494258
+... 3-102-498080
+... 3-102-498709
+... 3-102-501440
+... 3-102-502513
+... 3-102-502518
+... 3-102-512999
+... 3-102-522409
+... 3-102-534902
+... 3-102-552393
+... 3-102-553610
+... 3-102-557234
+... 3-102-590174
+... 3-102-594362
+... 3-102-596051
+... 3-102-599561
+... 3-102-601289
+... 3-102-602493
+... 3-102-604962
+... 3-102-606587
+... 3-102-644127
+... 3-102-644839
+... 3-102-655271
+... 3-105-535891
+... 3-105-637662
+... 3-105-654822
+... 3101265235
+... 3101269160
+... 3101317433
+... 3102749784
+... 4-000-000019
+... 4-000-042152
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not cpj.is_valid(x)]
+[]

-----------------------------------------------------------------------

Summary of changes:
 stdnum/{za => cr}/__init__.py                     |   4 +-
 stdnum/cr/cpf.py                                  | 105 +++++++++
 stdnum/cr/cpj.py                                  | 103 ++++++++
 stdnum/{za/tin.py => cr/cr.py}                    |  51 ++--
 tests/test_cr_cpf.doctest                         | 207 ++++++++++++++++
 tests/test_cr_cpj.doctest                         | 275 ++++++++++++++++++++++
 tests/{test_za_tin.doctest => test_cr_cr.doctest} |  48 ++--
 7 files changed, 748 insertions(+), 45 deletions(-)
 copy stdnum/{za => cr}/__init__.py (89%)
 create mode 100644 stdnum/cr/cpf.py
 create mode 100644 stdnum/cr/cpj.py
 copy stdnum/{za/tin.py => cr/cr.py} (54%)
 create mode 100644 tests/test_cr_cpf.doctest
 create mode 100644 tests/test_cr_cpj.doctest
 copy tests/{test_za_tin.doctest => test_cr_cr.doctest} (61%)


hooks/post-receive
-- 
python-stdnum