Skip to content

Commit

Permalink
Apply ruff format for parameterizing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
behnam-zakeri committed Apr 11, 2024
1 parent 386c5c8 commit efd35f7
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions message_ix/tests/test_feature_price_emission.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,18 @@ def test_custom_type_variable_periodlength(test_mp, request):

npt.assert_allclose(obs, exp)


@pytest.mark.parametrize(
"cumulative_bound, years, tag",
(
[
(0.25, [2020, 2030, 2040, 2050], "0.25_equal"),
(0.25, [2020, 2025, 2030, 2040, 2050], "0.25_varying"),
(0.50, [2020, 2030, 2040, 2050], "0.5_equal")
(0.50, [2020, 2025, 2030, 2040, 2050], "0.5_varying")
(0.75, [2020, 2030, 2040, 2050], "0.75_equal")
(0.50, [2020, 2030, 2040, 2050], "0.5_equal"),
(0.50, [2020, 2025, 2030, 2040, 2050], "0.5_varying"),
(0.75, [2020, 2030, 2040, 2050], "0.75_equal"),
(0.75, [2020, 2025, 2030, 2040, 2050], "0.75_varying"),
)
)
],
)
def test_price_duality(test_mp, request, cumulative_bound, years, tag):
# set up a scenario for cumulative constraints
scen = Scenario(test_mp, MODEL, "cum_many_tecs_" + tag, version="new")
Expand All @@ -222,7 +223,7 @@ def test_price_duality(test_mp, request, cumulative_bound, years, tag):
"bound_emission",
["World", "ghg", "all", "cumulative"],
cumulative_bound,
"tCO2"
"tCO2",
)
scen.commit("initialize test scenario")
scen.solve(quiet=True)
Expand All @@ -231,9 +232,7 @@ def test_price_duality(test_mp, request, cumulative_bound, years, tag):
# Run scenario with `tax_emission` based on `PRICE_EMISSION`
# from cumulative constraint scenario.
# ----------------------------------------------------------
tax_scen = Scenario(
test_mp, MODEL, scenario="tax_many_tecs_" + tag, version="new"
)
tax_scen = Scenario(test_mp, MODEL, scenario="tax_many_tecs_" + tag, version="new")
model_setup(tax_scen, years, simple_tecs=False)
for y in years:
tax_scen.add_cat("year", y, y)
Expand Down Expand Up @@ -265,9 +264,7 @@ def test_price_duality(test_mp, request, cumulative_bound, years, tag):
# from cumulative constraint scenario.
# --------------------------------------------------------

perbnd_scen = Scenario(
test_mp, MODEL, "period-bnd_many_tecs_" + tag, version="new"
)
perbnd_scen = Scenario(test_mp, MODEL, "period-bnd_many_tecs_" + tag, version="new")
model_setup(perbnd_scen, years, simple_tecs=False)
for y in years:
perbnd_scen.add_cat("year", y, y)
Expand Down

0 comments on commit efd35f7

Please sign in to comment.