Skip to content

Commit 005d8b2

Browse files
committed
Switch to positive values and update tests
1 parent fe2e7a9 commit 005d8b2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

kwave/options/simulation_execution_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def checkpoint_interval(self) -> Optional[int]:
209209
@checkpoint_interval.setter
210210
def checkpoint_interval(self, value: Optional[int]):
211211
if value is not None:
212-
if not isinstance(value, int) or value < 0:
212+
if not isinstance(value, int) or value <= 0:
213213
raise ValueError("Checkpoint interval must be a positive integer in seconds")
214214
self._checkpoint_interval = value
215215

tests/test_simulation_execution_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,12 @@ def test_checkpoint_interval_validation(self):
301301
options = self.default_options
302302

303303
# Test valid values
304-
options.checkpoint_interval = 0
305-
self.assertEqual(options.checkpoint_interval, 0)
306304
options.checkpoint_interval = 100
307305
self.assertEqual(options.checkpoint_interval, 100)
308306

309307
# Test invalid values
308+
with self.assertRaises(ValueError):
309+
options.checkpoint_interval = 0
310310
with self.assertRaises(ValueError):
311311
options.checkpoint_interval = -1
312312
with self.assertRaises(ValueError):

0 commit comments

Comments
 (0)