Skip to content

Issues building compact representation for EU format #427

Closed
@DavideWalder

Description

@DavideWalder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions