Skip to content

Commit

Permalink
Make test more explicit per suggestion by @znicholls
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann committed Aug 4, 2023
1 parent 04599a5 commit 98f59f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ def test_init_df_from_timeseries_unused_levels(test_df):
# this test guards against regression for the bug
# reported in https://github.com/IAMconsortium/pyam/issues/762

for _, df in test_df.timeseries().groupby(["model", "scenario"]):
for (model, scenario), data in test_df.timeseries().groupby(["model", "scenario"]):
# we're only interested in the second model-scenario combination
pass
if model == "model_a" and scenario == "scen_b":
df = IamDataFrame(data)

# pandas does not remove unused levels (here: "Primary Energy|Coal") in a groupby
assert IamDataFrame(df).variable == ["Primary Energy"]
# pandas 2.0 does not remove unused levels (here: "Primary Energy|Coal") in groupby
# we check that unused levels are removed at initialization of the IamDataFrame
assert df.variable == ["Primary Energy"]


def test_init_df_with_extra_col(test_pd_df):
Expand Down

0 comments on commit 98f59f0

Please sign in to comment.