Example #1
0
 def test_timestep_before(self):
     sos_model = SosModel('test')
     sos_model.timesteps = [2010, 2011, 2012]
     assert sos_model.timestep_before(2010) is None
     assert sos_model.timestep_before(2011) == 2010
     assert sos_model.timestep_before(2012) == 2011
     assert sos_model.timestep_before(2013) is None
Example #2
0
 def test_timestep_after(self):
     sos_model = SosModel('test')
     sos_model.timesteps = [2010, 2011, 2012]
     assert sos_model.timestep_after(2010) == 2011
     assert sos_model.timestep_after(2011) == 2012
     assert sos_model.timestep_after(2012) is None
     assert sos_model.timestep_after(2013) is None
Example #3
0
def get_sos_model_object(get_sector_model_object, get_scenario_model_object):

    sos_model = SosModel('test_sos_model')
    sector_model = get_sector_model_object
    scenario_model = get_scenario_model_object
    sos_model.add_model(sector_model)
    sos_model.add_model(scenario_model)
    sos_model.timesteps = scenario_model.timesteps
    sector_model.add_dependency(scenario_model, 'raininess', 'raininess')

    return sos_model