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 importlib.util | |
| import sys | |
| from pathlib import Path | |
| import pytest | |
| ROOT = Path(__file__).resolve().parents[1] | |
| DATASET_DIR = ROOT / "hf_dataset" | |
| spec = importlib.util.spec_from_file_location("isora", DATASET_DIR / "isora.py") | |
| isora = importlib.util.module_from_spec(spec) | |
| sys.modules["isora"] = isora | |
| spec.loader.exec_module(isora) | |
| needs_build = pytest.mark.skipif( | |
| not (DATASET_DIR / "data" / "panel.parquet").exists(), reason="run the build first" | |
| ) | |
| def test_loader_reads_local_tables_and_helpers_work(): | |
| kw = {"local_dir": str(DATASET_DIR)} | |
| obs = isora.load("observations", **kw) | |
| assert {"jurisdiction_code", "indicator_code", "fiscal_year", "value_numeric"} <= set( | |
| obs.columns | |
| ) | |
| pan = isora.panel(**kw) | |
| assert {"jurisdiction_code", "fiscal_year", "revenue_to_gdp_pct", "income_group_wb"} <= set( | |
| pan.columns | |
| ) | |
| assert not pan.duplicated(["jurisdiction_code", "fiscal_year"]).any() | |
| hits = isora.search("arrears", **kw) | |
| assert (hits["indicator_code"] == "337_092").any() | |
| desc = isora.describe("337_001", **kw) | |
| assert "ISORA 2020+" in desc.index | |
| w = isora.wide(["337_001"], **kw) | |
| assert ("337_001", 2022) in w.columns | |
| s = isora.series("80040_3", ["FRA"], **kw) | |
| assert (s["fiscal_year"] == 2022).any() and s["value_local_currency_units"].notna().any() | |
| def test_unknown_table_raises(): | |
| with pytest.raises(KeyError): | |
| isora.load("nope", local_dir=str(DATASET_DIR)) | |