| Total Complexity | 3 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from synergine.test.TestSimulation import TestSimulation as BaseTestSimulation |
||
| 7 | class TestCycleCallback(BaseTestSimulation): |
||
| 8 | |||
| 9 | _callback_call_count = -1 |
||
| 10 | |||
| 11 | def _get_set_up_simulations(self): |
||
| 12 | return [TestSimulationSimulation([TestCollection(TestCollectionConfiguration())])] |
||
| 13 | |||
| 14 | def test_cycles_callbacks(self): |
||
| 15 | self._connection.receive_callback = self._cycle_callback |
||
| 16 | |||
| 17 | self._callback_call_count = -1 |
||
| 18 | core = self.get_core(5) |
||
| 19 | core.run() |
||
| 20 | |||
| 21 | self.assertEquals(5, self._callback_call_count) |
||
| 22 | |||
| 23 | def _cycle_callback(self, terminal, actions_done): |
||
| 24 | self._callback_call_count += 1 |
||
| 25 | self.assertEquals(self._callback_call_count, terminal.get_context().get_cycle()) |
||
| 26 |