-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add explicit model registration parser test
- Loading branch information
1 parent
89af10a
commit 19c8591
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |