Skip to content

Commit

Permalink
Adjust 1 test for pyam-iamc ≥ 3
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Dec 30, 2024
1 parent b1b7941 commit 2cae4bb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions genno/tests/compat/test_pyam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
from collections import namedtuple
from functools import partial
from importlib.metadata import version
from typing import TYPE_CHECKING

import pandas as pd
Expand Down Expand Up @@ -179,6 +180,11 @@ def add_tm(df, name="Activity"):
idf2 = c.get(key2)
df2 = idf2.as_pandas()

# Adjust changes in behaviour in pyam-iamc ≥ 3 (Python ≥ 3.10) and < 3 (Python 3.9)
if version("pyam-iamc") >= "3.0.0":
# Version of pyam-iamc that does not sort 'region' and 'variable' dimensions
df2 = df2.sort_values(["region", "variable"], ignore_index=True)

# Extra columns have been removed:
# - m and t by the collapse callback.
# - h automatically, because 'ya' was used for the year index.
Expand Down

0 comments on commit 2cae4bb

Please sign in to comment.