Datasets:
Formats:
parquet
Languages:
English
Size:
100K - 1M
Tags:
isora
international-survey-on-revenue-administration
tax-administration
revenue-administration
tax-authority
taxation
License:
v1.1.0: consolidated panel + panel_dictionary, isora.py loader, World Bank income groups (current + per fiscal year), thousands flag on derived expenditure aggregates
9f0fcd7 verified | import pandas as pd | |
| from isora_hf.worldbank import ( | |
| ISORA_TO_WB_CODE, | |
| _fy_label_to_year, | |
| classification_year, | |
| income_group_for_years, | |
| wb_code, | |
| ) | |
| def test_code_mapping_covers_imf_specific_codes(): | |
| assert wb_code("KOS") == "XKX" | |
| assert wb_code("UAE") == "ARE" | |
| assert wb_code("FRA") == "FRA" | |
| assert set(ISORA_TO_WB_CODE) == {"KOS", "UAE"} | |
| def test_fy_labels_and_alignment_rule(): | |
| assert _fy_label_to_year("FY25") == 2025 | |
| assert _fy_label_to_year("FY89") == 1989 | |
| assert _fy_label_to_year("2025") is None | |
| assert classification_year(2022) == 2024 # FY24 groups are based on 2022 GNI | |
| def test_income_group_lookup_uses_same_year_gni(): | |
| history = pd.DataFrame( | |
| [ | |
| {"wb_code": "XKX", "wb_fiscal_year": 2020, "income_group": "Lower middle income"}, | |
| {"wb_code": "XKX", "wb_fiscal_year": 2024, "income_group": "Upper middle income"}, | |
| ] | |
| ) | |
| keys = pd.DataFrame( | |
| {"jurisdiction_code": ["KOS", "KOS", "FRA"], "fiscal_year": [2018, 2022, 2022]} | |
| ) | |
| got = income_group_for_years(history, keys).tolist() | |
| assert got[0] == "Lower middle income" and got[1] == "Upper middle income" | |
| assert pd.isna(got[2]) | |