From d0f198d75d5157b076a70cf6b0867663906a151c Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Fri, 20 Oct 2023 14:17:12 +0200 Subject: [PATCH] Check specific values in test_compat() --- message_ix_models/tests/report/test_compat.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/message_ix_models/tests/report/test_compat.py b/message_ix_models/tests/report/test_compat.py index 11a058decc..771bf20088 100644 --- a/message_ix_models/tests/report/test_compat.py +++ b/message_ix_models/tests/report/test_compat.py @@ -9,6 +9,8 @@ @MARK[0] def test_compat(test_context): + import numpy.testing as npt + rep = ss_reporter() prepare_reporter(test_context, reporter=rep) @@ -24,13 +26,22 @@ def test_compat(test_context): # key = "_26" # Fourth level # print(rep.describe(key)) + # rep.visualize("transport-emissions-full-iamc.svg", key) # Calculation runs result = rep.get(key) # print(result.to_string()) # print(result.as_pandas().to_string()) - del result + + # Check a specific value + # TODO Expand set of expected values + npt.assert_allclose( + result.as_pandas() + .query("region == 'R11_AFR' and year == 2020")["value"] + .item(), + 54.0532, + ) def test_prepare_techs(test_context):