lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.20-22-g0f94ca6

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

python-stdnum branch master updated. 1.20-22-g0f94ca6



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  0f94ca6b48ea690d3937d1c9a83d76406d2cf451 (commit)
      from  928a09ded2505d1d307833ae180e24eff6b78dcd (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=0f94ca6b48ea690d3937d1c9a83d76406d2cf451

commit 0f94ca6b48ea690d3937d1c9a83d76406d2cf451
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Feb 15 16:17:09 2025 +0100

    Support Ecuador public RUC with juridical format
    
    It seems that numbers with a format used for juridical RUCs have been
    issued to companies.
    
    Closes https://github.com/arthurdejong/python-stdnum/issues/457

diff --git a/stdnum/ec/ruc.py b/stdnum/ec/ruc.py
index c68bf0f..c49b4fc 100644
--- a/stdnum/ec/ruc.py
+++ b/stdnum/ec/ruc.py
@@ -99,8 +99,11 @@ def validate(number):
         except ValidationError:
             _validate_natural(number)
     elif number[2] == '9':
-        # 9 = juridical RUC
-        _validate_juridical(number)
+        # 9 = juridical RUC (or public RUC)
+        try:
+            _validate_public(number)
+        except ValidationError:
+            _validate_juridical(number)
     else:
         raise InvalidComponent()  # third digit wrong
     return number
diff --git a/tests/test_ec_ruc.doctest b/tests/test_ec_ruc.doctest
index 2483a44..b0047e8 100644
--- a/tests/test_ec_ruc.doctest
+++ b/tests/test_ec_ruc.doctest
@@ -288,6 +288,7 @@ Normal juridical RUC values (third digit is 9) that should 
just work.
 ... 1792141869001
 ... 1792147638001
 ... 1792373255001
+... 1793221293001
 ... 1890001323001
 ... 1890003628001
 ... 1890037646001

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

Summary of changes:
 stdnum/ec/ruc.py          | 7 +++++--
 tests/test_ec_ruc.doctest | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
python-stdnum