Total Complexity | 5 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | import unittest |
||
7 | class TestActionManager(unittest.TestCase): |
||
8 | |||
9 | def test_action_manager(self): |
||
10 | action_manager = ActionManager() |
||
11 | actions = [A, B, C, D, E, F, G, H] |
||
12 | steps_correct_order = [ |
||
13 | ['A', 'D', 'G'], |
||
14 | ['B'], |
||
15 | ['C', 'H'], |
||
16 | ['F'], |
||
17 | ['E'] |
||
18 | ] |
||
19 | self.assertEqual(steps_correct_order, self._get_class_name_representation(action_manager.get_steps_for_actions(actions))) |
||
20 | |||
21 | for i in range(10): |
||
22 | shuffle(actions) |
||
23 | self.assertEqual(steps_correct_order, self._get_class_name_representation(action_manager.get_steps_for_actions(actions))) |
||
24 | |||
25 | def _get_class_name_representation(self, steps): |
||
26 | steps_representation = [] |
||
27 | for step in steps: |
||
28 | step_representation = [] |
||
29 | for action in step: |
||
30 | step_representation.append(action.__name__) |
||
31 | steps_representation.append(sorted(step_representation)) |
||
32 | return steps_representation |