From 22eac700a73dcd5732224c04d564918a3b74d2da Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 3 Apr 2020 18:04:23 +0200 Subject: [PATCH] check the input data for "unit" --- message_ix/macro.py | 2 +- message_ix/tests/test_macro.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/message_ix/macro.py b/message_ix/macro.py index 3e7fd16a2..be1acfc72 100644 --- a/message_ix/macro.py +++ b/message_ix/macro.py @@ -135,7 +135,7 @@ def validate(kind, values, df): cols = MACRO_DATA_FOR_DERIVATION[name] else: cols = MACRO_ITEMS[name]['idx_sets'] - col_diff = set(cols) - set(df.columns) + col_diff = set(cols + ['unit']) - set(df.columns) if col_diff: raise ValueError(f"Missing expected columns for {name}: {col_diff}") diff --git a/message_ix/tests/test_macro.py b/message_ix/tests/test_macro.py index 625b27a80..381bc4662 100644 --- a/message_ix/tests/test_macro.py +++ b/message_ix/tests/test_macro.py @@ -86,7 +86,7 @@ def test_config(westeros_solved): # removing a column from config and testing data = c.data.copy() - data['config'] = c.data['config'][['node', 'sector']] + data['config'] = c.data['config'][['node', 'sector']] try: macro.Calculate(s, data) except KeyError as error: