def test_setting_getting_influx_concentration(self, tmp_path): p = utilities.yaml_from_dict(tmp_path, 'input.yaml') _delta = DeltaModel(input_file=p) # mock the init methods _delta.create_boundary_conditions = mock.MagicMock() _delta.init_sediment_routers = mock.MagicMock() # check initials assert _delta.influx_sediment_concentration == 0.1 # change and assert changed _delta.influx_sediment_concentration = 0.003 assert _delta.C0_percent == 0.3 # assert reinitializers called assert (_delta.create_boundary_conditions.called is True) assert (_delta.init_sediment_routers.called is True)
def test_setting_getting_flow_depth(self, tmp_path): p = utilities.yaml_from_dict(tmp_path, 'input.yaml') _delta = DeltaModel(input_file=p) # mock the init methods _delta.create_boundary_conditions = mock.MagicMock() _delta.init_sediment_routers = mock.MagicMock() # check initials assert _delta.channel_flow_depth == 5 # change and assert changed _delta.channel_flow_depth = 2 assert _delta.channel_flow_depth == 2 assert _delta.channel_flow_depth == _delta.h0 assert _delta.channel_flow_depth == _delta._h0 # assert reinitializers called assert (_delta.create_boundary_conditions.called is True) assert (_delta.init_sediment_routers.called is True)
def test_setting_getting_channel_width(self, tmp_path): p = utilities.yaml_from_dict(tmp_path, 'input.yaml') _delta = DeltaModel(input_file=p) _delta.create_boundary_conditions = mock.MagicMock() _delta.init_sediment_routers = mock.MagicMock() # check initials assert _delta.channel_width == 250 # change value # the channel width is then changed internally with `N0`, according # to the `create_boundary_conditions` so no change is actually made # here. with pytest.warns(UserWarning): _delta.channel_width = 300 assert _delta.channel_width == 250 # not changed! # assert reinitializers called assert (_delta.create_boundary_conditions.called is True) assert (_delta.init_sediment_routers.called is True)