Commit 9db99c9
Auto step counter (#117)
This pull request introduces a new step counter feature to the `ModelDF` class and adds corresponding tests. The main changes include adding a step counter, modifying the `step` method to increment the counter, and adding tests to verify the new functionality.
Enhancements to `ModelDF` class:
* [`mesa_frames/concrete/model.py`](diffhunk://#diff-c5db932a22d9e3b30ff7eead6d38e655cf3be4fee195a6fe18409bbe3c575ddcR88-R101): Introduced a new private attribute `_steps` to keep track of the step count and added a property `steps` to retrieve the current step count. Modified the `step` method to increment the step counter automatically by wrapping the user-defined `step` method. [[1]](diffhunk://#diff-c5db932a22d9e3b30ff7eead6d38e655cf3be4fee195a6fe18409bbe3c575ddcR88-R101) [[2]](diffhunk://#diff-c5db932a22d9e3b30ff7eead6d38e655cf3be4fee195a6fe18409bbe3c575ddcR150-R160)
Testing the new step counter:
* [`tests/test_modeldf.py`](diffhunk://#diff-2be7ad75672aa528662114edd128ae28ae41de2919b9e1740388a914a74122ffR1-R37): Added a new test class `Test_ModelDF` to verify the functionality of the step counter. This includes tests for the default step counter behavior and custom user-defined step behavior.
---------
Co-authored-by: Adam Amer <136176500+adamamer20@users.noreply.github.com>1 parent 3e4d349 commit 9db99c9
2 files changed
+62
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
88 | 102 | | |
89 | 103 | | |
90 | 104 | | |
| |||
133 | 147 | | |
134 | 148 | | |
135 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
136 | 161 | | |
137 | 162 | | |
138 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments