From b14e24a0912326aef537d8cbbee6c78706aa71e5 Mon Sep 17 00:00:00 2001 From: David Almeida Date: Wed, 18 Sep 2024 17:11:35 +0200 Subject: [PATCH] Test pysquirrel integration --- tests/data/general-config-only-nuts/nomenclature.yaml | 8 ++++++++ tests/test_definition.py | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/data/general-config-only-nuts/nomenclature.yaml diff --git a/tests/data/general-config-only-nuts/nomenclature.yaml b/tests/data/general-config-only-nuts/nomenclature.yaml new file mode 100644 index 00000000..9ce43a07 --- /dev/null +++ b/tests/data/general-config-only-nuts/nomenclature.yaml @@ -0,0 +1,8 @@ +dimensions: + - region +definitions: + region: + nuts: + nuts-1: [ AT ] + nuts-2: [ BE ] + nuts-3: [ CZ ] diff --git a/tests/test_definition.py b/tests/test_definition.py index 0f1d8cc1..5dfc1e27 100644 --- a/tests/test_definition.py +++ b/tests/test_definition.py @@ -65,6 +65,17 @@ def test_definition_general_config_country_only(): assert all(region in obs.region for region in ("Austria", "Bolivia", "Kosovo")) +def test_definition_general_config_nuts_only(): + """Check that DataStructureDefinition is properly initialised with NUTS region config only""" + obs = DataStructureDefinition( + TEST_DATA_DIR / "general-config-only-nuts" / "definitions" + ) + assert all(region[:2] in ("AT", "BE", "CZ") for region in obs.region) + assert len([region for region in obs.region if region.startswith("AT")]) == 4 + assert len([region for region in obs.region if region.startswith("BE")]) == 12 + assert len([region for region in obs.region if region.startswith("CZ")]) == 15 + + def test_to_excel(simple_definition, tmpdir): """Check writing a DataStructureDefinition to file""" file = tmpdir / "testing_export.xlsx"