Skip to content

Commit 81f52ad

Browse files
committed
Add tests for ContinuousObservable
Adds test_continuous_observables.py with 19 tests covering the full functionality of continuous state management in mesa_signals: Basic functionality: - Constant and variable rate depletion over time - Manual value setting (e.g., energy boost from eating) - Time-based lazy evaluation Signal emissions: - Change notifications when values update - Threshold crossing detection (upward and downward) - Multiple threshold management - No signals when values don't change Edge cases: - Zero elapsed time (no spurious updates) - Multiple accesses at same time point (single calculation) - Exact threshold values (inclusive boundary handling) - Negative values (energy going below zero) - NumPy float compatibility (fixes AttributeError with random values) Integration: - Computed properties based on continuous observables - Batch agent creation with numpy arrays - Both DEVSimulator (float time) and ABMSimulator (integer steps) - Wolf-sheep predator-prey scenario with death thresholds All tests use proper discrete event scheduling through Mesa's simulator rather than manual time manipulation, ensuring realistic simulation behavior.
1 parent 2b059ff commit 81f52ad

File tree

1 file changed

+606
-0
lines changed

1 file changed

+606
-0
lines changed

0 commit comments

Comments
 (0)