Skip to content

Commit

Permalink
678: Update ObservationCrossSection test to be similar to the CrossSe…
Browse files Browse the repository at this point in the history
…ction test.
  • Loading branch information
tim-vd-aardweg committed Jul 8, 2024
1 parent c5d7c03 commit 5c17777
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tests/dflowfm/test_obscrosssection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5c17777

Please sign in to comment.