Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues building compact representation for EU format #427

Closed
DavideWalder opened this issue Feb 1, 2024 · 1 comment
Closed

Issues building compact representation for EU format #427

DavideWalder opened this issue Feb 1, 2024 · 1 comment

Comments

@DavideWalder
Copy link

To reproduce:

import stdnum.vatin

vat = "EU191849184"
assert stdnum.vatin.is_valid(vat)

stdnum.vatin.compact(vat)

Traceback:

.venv/lib/python3.11/site-packages/stdnum/vatin.py:77: in compact
    return number[:2] + module.compact(number[2:])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

number = '191849184'

    def compact(number):
        """Convert the number to the minimal representation. This strips the
        number of any valid separators and removes surrounding whitespace."""
        number = clean(number, '').upper().strip()
        cc = number[:2]
        module = _get_cc_module(cc)
        if not module:
>           raise InvalidComponent()
E           stdnum.exceptions.InvalidComponent: One of the parts of the number are invalid or unknown.

It looks like it tries to retrieve the country code twice

@arthurdejong
Copy link
Owner

Thanks for pointing this out. I has been fixed in 1e412ee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants