Correctness
Correctness¶
The point of this package is not "fast country lookup" — it is "fast country lookup you can swap in without your results moving". tests/test_parity.py asserts agreement with pycountry over four corpora:
- Every indexed value in ISO 3166-1 — each alpha-2, alpha-3, numeric code, name, official name, common name and flag in the standard, in original, upper and lower case. If the two agree on every string the table contains, they agree on every exact lookup that can succeed.
- Every ISO 3166-2 code — all ~5,000 of them, checked against
pycountry.subdivisions.get. - Every ISO 4217 value — codes, numbers and names.
- A fuzzy corpus — every country name and subdivision name, plus hand-written messy input, compared against
pycountry.countries.search_fuzzyresult by result, including the ranking.
Both sides are pointed at the same table files, so a disagreement can only be an algorithm difference — never two different snapshots. tests/test_data.py separately asserts the vendored tables are the ones the installed pycountry ships.
The known, deliberate divergences are blank input (null rather than "every country"), and no fuzzy search over currencies or the historic table. Everything else agreeing is the contract; if you find an input where this package and pycountry disagree, that is a bug here. Please open an issue with the input.