def test_opt_dur_true_with_changer(clock_02, grid_1, precip_defaults): precip_changer = PrecipChanger(grid_1, **precip_defaults) params = { "grid": grid_1, "opt_stochastic_duration": True, "clock": clock_02, "boundary_handlers": { "PrecipChanger": precip_changer }, } with pytest.raises(ValueError): StochasticErosionModel(**params)
def test_init_record_opt_true(clock_simple, grid_1): model = StochasticErosionModel(clock=clock_simple, grid=grid_1, record_rain=True) assert model.record_rain is True assert isinstance(model.rain_record, dict) fields = [ "event_start_time", "event_duration", "rainfall_rate", "runoff_rate", ] for f in fields: assert f in model.rain_record assert len(model.rain_record[f]) == 0
def test_init_record_opt_false(clock_simple, grid_1): params = {"clock": clock_simple, "record_rain": False, "grid": grid_1} model = StochasticErosionModel(**params) assert model.record_rain is False assert model.rain_record is None
def test_defaults(clock_simple, grid_1): model = StochasticErosionModel(clock=clock_simple, grid=grid_1) assert model.opt_stochastic_duration is False assert model.record_rain is False