Completed
Pull Request — master (#45)
by Wojtek
01:58
created

TestGroupedOptimizer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
A test___init__() 0 6 1
1
"""Module for testing grouped optimizer."""
2
3
import unittest.mock as mock
4
from unittest import TestCase
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.Mock()
20
        self.third_stage_b = mock.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, mock.Mock(),
28
                                     mock.Mock())
29
        self.assertIsNotNone(optimizer)
30
        self.assertEqual(optimizer.process, self.some_process)
31