Datasets:
Formats:
parquet
Languages:
English
Size:
100K - 1M
Tags:
isora
international-survey-on-revenue-administration
tax-administration
revenue-administration
tax-authority
taxation
License:
ISORA FY2014-FY2024 v1.0.0: observations, indicators, indicator_history, jurisdictions, coverage, revisions + card, license, pipeline
cbd273f verified | from isora_hf.revisions import ( | |
| CHANGE_ADDED, | |
| CHANGE_REMOVED, | |
| CHANGE_SCALE, | |
| CHANGE_TEXT, | |
| CHANGE_VALUE, | |
| canonical, | |
| classify, | |
| ) | |
| def test_canonical_strips_thousands_separators_and_parses_numbers(): | |
| assert canonical("1,148,486") == ("number", 1148486.0, 0) | |
| assert canonical(" 12.5 ") == ("number", 12.5, 1) | |
| assert canonical("") == ("missing", None, 0) | |
| assert canonical(None) == ("missing", None, 0) | |
| assert canonical("Yes ") == ("text", "yes", 0) | |
| def test_formatting_and_precision_only_differences_are_not_changes(): | |
| assert classify(["31,378", "31378", "31378"]) is None | |
| assert classify(["99.39464694945302", "99.39464695"]) is None | |
| assert classify(["26.95", "26.94513581", "26.94513581"]) is None # rounded in older release | |
| assert classify(["27", "26.6"]) is None # agrees at the coarser (integer) precision | |
| assert classify(["26.95", "27.10"]) == CHANGE_VALUE | |
| assert classify(["No", "No", "No"]) is None | |
| assert classify(["Yes", "yes"]) is None | |
| def test_scale_convention_change_is_detected(): | |
| assert classify(["4469256.066", "4469256066", "4469256066"]) == CHANGE_SCALE | |
| def test_real_numeric_revision(): | |
| assert classify(["100", "100", "120"]) == CHANGE_VALUE | |
| assert classify(["100", "D"]) == CHANGE_VALUE # number replaced by a sentinel | |
| def test_added_and_removed_keys(): | |
| assert classify([None, "No", "No"]) == CHANGE_ADDED | |
| assert classify(["No", "No", None]) == CHANGE_REMOVED | |
| assert classify([None, None]) is None | |
| def test_text_revision_ignores_mojibake_and_case(): | |
| same = ["from ‘tax type’", "from ‘tax type’"] | |
| assert classify(same) is None | |
| assert classify(["Produced and published", "Produced, not published"]) == CHANGE_TEXT | |