fix(simulation): use hydraulic timestep

This commit is contained in:
2026-07-16 14:16:06 +08:00
parent f72b56845f
commit 775ecb8a58
6 changed files with 121 additions and 20 deletions
+26
View File
@@ -43,3 +43,29 @@ def test_utc_now_returns_timezone_aware_utc_datetime():
assert result.tzinfo == timezone.utc
assert result.utcoffset() == timedelta(0)
@pytest.mark.parametrize(
("clock", "expected_seconds"),
[
("1:00", 3600),
("01:00", 3600),
("0:05", 300),
("0:05:00", 300),
("24:00", 86400),
],
)
def test_parse_clock_duration_seconds_accepts_epanet_clock_formats(
clock, expected_seconds
):
module = _load_time_api_module()
assert module.parse_clock_duration_seconds(clock) == expected_seconds
@pytest.mark.parametrize("clock", ["bad", "1:60", "1:00:60", "-1:00"])
def test_parse_clock_duration_seconds_rejects_invalid_clock_formats(clock):
module = _load_time_api_module()
with pytest.raises(ValueError):
module.parse_clock_duration_seconds(clock)