Skip to content

Commit

Permalink
nrow
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Jan 26, 2024
1 parent 6301379 commit 89e2ca9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python/ribasim/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,15 @@ def test_plot(discrete_control_of_pid_control):
def test_write_adds_fid_in_tables(basic, tmp_path):
model_orig = basic
# for node an explicit index was provided
nrow = len(model_orig.network.node.df)
assert model_orig.network.node.df.index.name == "fid"
assert model_orig.network.node.df.index.equals(pd.RangeIndex(start=1, stop=18))
assert model_orig.network.node.df.index.equals(
pd.RangeIndex(start=1, stop=nrow + 1)
)
# for edge no index was provided, but it still needs to write it to file
nrow = len(model_orig.network.edge.df)
assert model_orig.network.edge.df.index.name is None
assert model_orig.network.edge.df.index.equals(pd.RangeIndex(start=0, stop=17))
assert model_orig.network.edge.df.index.equals(pd.RangeIndex(start=0, stop=nrow))

model_orig.write(tmp_path / "basic/ribasim.toml")
with connect(tmp_path / "basic/database.gpkg") as connection:
Expand Down

0 comments on commit 89e2ca9

Please sign in to comment.