Skip to content

Commit

Permalink
adapt comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Jingru923 committed May 3, 2024
1 parent 249c345 commit be49e53
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
19 changes: 0 additions & 19 deletions python/ribasim/ribasim/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,25 +229,6 @@ def _children(self):
if isinstance(getattr(self, k), ChildModel)
}

def validate_model_node_field_ids(self):
"""Check whether the node IDs of the node_type fields are valid."""

raise NotImplementedError()

def validate_model_node_ids(self):
raise NotImplementedError()

def validate_model(self):
"""Validate the model.
Checks:
- Whether the node IDs of the node_type fields are valid
- Whether the node IDs in the node field correspond to the node IDs on the node type fields
"""

self.validate_model_node_field_ids()
self.validate_model_node_ids()

@classmethod
def read(cls, filepath: str | PathLike[str]) -> "Model":
"""Read model from TOML file."""
Expand Down
8 changes: 2 additions & 6 deletions python/ribasim/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ribasim.geometry.edge import NodeData
from ribasim.input_base import esc_id
from ribasim.model import Model
from ribasim.nodes import pump
from shapely import Point


Expand Down Expand Up @@ -67,15 +66,12 @@ def test_exclude_unset(basic):
assert d["solver"]["saveat"] == 86400.0


# @pytest.mark.xfail(reason="Needs implementation")
def test_invalid_node_id(basic):
model = basic

def test_invalid_node_id():
with pytest.raises(
ValueError,
match=r".* Input should be greater than or equal to 0 .*",
):
model.pump.add(Node(-1, Point(7.0, 7.0)), [pump.Static(flow_rate=[0.5 / 3600])])
Node(-1, Point(7.0, 7.0))


@pytest.mark.xfail(reason="Should be reimplemented by the .add() API.")
Expand Down

0 comments on commit be49e53

Please sign in to comment.