From 5c177773b7525ad28f52d83a90940f1915c506b0 Mon Sep 17 00:00:00 2001 From: Tim van den Aardweg Date: Mon, 8 Jul 2024 19:11:02 +0200 Subject: [PATCH] 678: Update ObservationCrossSection test to be similar to the CrossSection test. --- tests/dflowfm/test_obscrosssection.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/dflowfm/test_obscrosssection.py b/tests/dflowfm/test_obscrosssection.py index b4e1457fb..f3f499a13 100644 --- a/tests/dflowfm/test_obscrosssection.py +++ b/tests/dflowfm/test_obscrosssection.py @@ -155,19 +155,23 @@ def test_create(self): assert isinstance(model.observationcrosssection, List) assert len(model.observationcrosssection) == 0 - def test_model_can_be_saved_and_loaded(self, tmp_path: Path): + def test_locationtype_is_not_written_for_observationcrosssection(self, tmp_path: Path): model = ObservationCrossSectionModel() - obs_crosssection = ObservationCrossSection( - name="testName", - branchId="testbranch", - chainage=123, + model.observationcrosssection.append( + ObservationCrossSection( + name="testName", + branchId="testbranch", + chainage=123, + ) ) - model.observationcrosssection.append(obs_crosssection) - model.observationcrosssection.append(obs_crosssection) - obs_crs_file = tmp_path / "test_crs.ini" + obs_crs_file = tmp_path / "obs_crs.ini" model.save(filepath=obs_crs_file) - _ = ObservationCrossSectionModel(filepath=obs_crs_file) + + with open(obs_crs_file, "r") as file: + content = file.read() + + assert "locationtype" not in content def _create_observation_cross_section_values() -> dict: