TestCycleCallback._get_set_up_simulations()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
1
from synergine.test.TestSimulation import TestSimulation as BaseTestSimulation
2
from tests.src.TestCollection import TestCollection
3
from tests.src.TestSimulation import TestSimulation as TestSimulationSimulation
4
from tests.src.TestCollectionConfiguration import TestCollectionConfiguration
5
6
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