Completed
Pull Request — master (#43)
by Wojtek
09:22
created

TestGroupedOptimizer.test___init__()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
1
"""Module for testing grouped optimizer."""
2
3
from unittest import TestCase
4
from unittest.mock import Mock
5
6
from grortir.main.model.core.abstract_process import AbstractProcess
7
from grortir.main.model.core.abstract_stage import AbstractStage
8
from grortir.main.optimizers.grouped_optimizer import GroupedOptimizer
9
10
11
class TestGroupedOptimizer(TestCase):
12
    """Class for testing Optimizer."""
13
14
    def setUp(self):
15
        """Set up environment."""
16
        self.some_process = AbstractProcess()
17
        self.first_stage = AbstractStage()
18
        self.second_stage = AbstractStage()
19
        self.third_stage_a = Mock()
20
        self.third_stage_b = Mock()
21
        self.some_process.add_path([self.first_stage, self.second_stage,
0 ignored issues
show
Bug introduced by
The Instance of AbstractProcess does not seem to have a member named add_path.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
22
                                    self.third_stage_a])
23
        self.some_process.add_edge(self.second_stage, self.third_stage_b)
0 ignored issues
show
Bug introduced by
The Instance of AbstractProcess does not seem to have a member named add_edge.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
24
25
    def test___init__(self):
26
        """Testing creating object."""
27
        optimizer = GroupedOptimizer(self.some_process)
28
        self.assertIsNotNone(optimizer)
29
        self.assertEqual(optimizer.process, self.some_process)
30
31
    def test_calling_functions(self):
32
        """Test correct order of calling function."""
33
        optimizer = GroupedOptimizer(self.some_process)
34
35
        optimizer.optimize_process()
36