def test_timeseries_remove_single_entry(mp): args_single = ('Douglas Adams', 'test_remove_single') scen = Scenario(mp, *args_single, version='new', annotation='fo') scen.add_timeseries(DATA['timeseries'].pivot_table(values='value', index=IDX_COLS)) scen.commit('importing a testing timeseries') scen = Scenario(mp, *args_single) assert_timeseries(scen, DATA['timeseries']) scen.check_out() scen.remove_timeseries(DATA['timeseries'][DATA['timeseries'].year == 2010]) scen.commit('testing for removing a single timeseries data point') exp = DATA['timeseries'][DATA['timeseries'].year == 2020] assert_timeseries(scen, exp)
def test_timeseries_remove_single_entry(mp): args_single = ("Douglas Adams", "test_remove_single") scen = Scenario(mp, *args_single, version="new", annotation="fo") scen.add_timeseries(DATA["timeseries"].pivot_table(values="value", index=IDX_COLS)) scen.commit("importing a testing timeseries") scen = Scenario(mp, *args_single) assert_timeseries(scen, DATA["timeseries"]) scen.check_out() scen.remove_timeseries(DATA["timeseries"][DATA["timeseries"].year == 2010]) scen.commit("testing for removing a single timeseries data point") exp = DATA["timeseries"][DATA["timeseries"].year == 2020] assert_timeseries(scen, exp)
def test_timeseries_remove_all_data(mp): args_all = ('Douglas Adams', 'test_remove_all') scen = Scenario(mp, *args_all, version='new', annotation='fo') scen.add_timeseries(DATA['timeseries'].pivot_table(values='value', index=IDX_COLS)) scen.commit('importing a testing timeseries') scen = Scenario(mp, *args_all) assert_timeseries(scen, DATA['timeseries']) exp = DATA['timeseries'].copy() exp['variable'] = 'Testing2' scen.check_out() scen.add_timeseries(exp) scen.remove_timeseries(DATA['timeseries']) scen.commit('testing for removing a full timeseries row') assert scen.timeseries(region='World', variable='Testing').empty assert_timeseries(scen, exp)
def test_timeseries_remove_all_data(mp): args_all = ("Douglas Adams", "test_remove_all") scen = Scenario(mp, *args_all, version="new", annotation="fo") scen.add_timeseries(DATA["timeseries"].pivot_table(values="value", index=IDX_COLS)) scen.commit("importing a testing timeseries") scen = Scenario(mp, *args_all) assert_timeseries(scen, DATA["timeseries"]) exp = DATA["timeseries"].copy() exp["variable"] = "Testing2" scen.check_out() scen.add_timeseries(exp) scen.remove_timeseries(DATA["timeseries"]) scen.commit("testing for removing a full timeseries row") assert scen.timeseries(region="World", variable="Testing").empty assert_timeseries(scen, exp)