def test_add_horizon(test_mp, args, kwargs, exp): scen = Scenario(test_mp, **SCENARIO['dantzig'], version='new') # Call completes successfully if isinstance(args[0], dict): with pytest.warns( DeprecationWarning, match=(r"dict\(\) argument to add_horizon\(\); use year= and " "firstmodelyear=")): scen.add_horizon(*args, **kwargs) else: scen.add_horizon(*args, **kwargs) # Sets and parameters have the expected contents npt.assert_array_equal(exp["year"], scen.set("year")) npt.assert_array_equal(exp["fmy"], scen.cat("year", "firstmodelyear")) npt.assert_array_equal(exp["dp"], scen.par("duration_period")["value"])
def test_cat_all(test_mp): scen = Scenario(test_mp, *msg_args) df = scen.cat('technology', 'all') npt.assert_array_equal(df, [ 'canning_plant', 'transport_from_seattle', 'transport_from_san-diego' ])