Skip to content

Commit

Permalink
Add explicit model registration parser test
Browse files Browse the repository at this point in the history
  • Loading branch information
phackstock committed Jan 18, 2024
1 parent 89af10a commit 19c8591
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Binary file not shown.
28 changes: 28 additions & 0 deletions tests/test_model_registration_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import yaml

from nomenclature import parse_model_registration

from conftest import TEST_DATA_DIR


def test_parse_model_registration(tmp_path):
parse_model_registration(
TEST_DATA_DIR / "region_aggregation" / "excel_model_registration.xlsx", tmp_path
)

# Test model mapping
with open(tmp_path / "Model 1.1_mapping.yaml", "r") as file:
obs_model_mapping = yaml.safe_load(file)
with open(
TEST_DATA_DIR / "region_aggregation" / "excel_mapping_reference.yaml", "r"
) as file:
exp_model_mapping = yaml.safe_load(file)
assert obs_model_mapping == exp_model_mapping

# Test model regions
with open(tmp_path / "Model 1.1_regions.yaml", "r") as file:
obs_model_regions = yaml.safe_load(file)
exp_model_regions = [
{"Model 1.1": ["Model 1.1|Region 1", "Region 2", "Model 1.1|Region 3"]}
]
assert obs_model_regions == exp_model_regions

0 comments on commit 19c8591

Please sign in to comment.