Skip to content

Commit 1d2f83f

Browse files
committed
Compare report output for "all::iamc"
1 parent 41f6cff commit 1d2f83f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

message_ix_models/tests/test_report.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ def test_prepare_reporter(test_context):
339339

340340
def test_compare(test_context) -> None:
341341
"""Compare the output of genno-based and legacy reporting."""
342-
key = "pe test"
342+
key = "all::iamc"
343+
# key = "pe test"
343344

344345
# Obtain the output from reporting `key` on `snapshot_id`
345346
snapshot_id: int = 1
@@ -393,10 +394,21 @@ def checks(df: pd.DataFrame):
393394
"value_rel = value_diff / value_left"
394395
)
395396

397+
na_left = tmp.isna()[["unit_left", "value_left"]]
398+
if na_left.any(axis=None):
399+
record(f"{prefix} {na_left.sum(axis=0).max()} missing left entries")
400+
tmp = tmp[~na_left.any(axis=1)]
401+
na_right = tmp.isna()[["unit_right", "value_right"]]
402+
if na_right.any(axis=None):
403+
record(f"{prefix} {na_right.sum(axis=0).max()} missing right entries")
404+
tmp = tmp[~na_right.any(axis=1)]
405+
396406
units_left = set(tmp.unit_left.unique())
397407
units_right = set(tmp.unit_right.unique())
398-
if units_left != units_right:
399-
record(f"{prefix} units mismatch: {units_left} != {units_right}")
408+
record(
409+
condition=units_left != units_right,
410+
message=f"{prefix} units mismatch: {units_left} != {units_right}",
411+
)
400412

401413
N0 = len(df)
402414

0 commit comments

Comments
 (0)