Completed
Push — master ( b6a1c4...aa0ea9 )
by Wojtek
02:08
created

test_get_maximal_acceptable_cost()   A

Complexity

Conditions 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
1
"""Module for testing."""
2
3
from unittest import TestCase
4
from unittest.mock import Mock
5
6
from grortir.main.model.core.abstract_stage import AbstractStage
7
8
9
class TestAbstractStage(TestCase):
10
    """Class for testing AbstractStage."""
11
12
    def test___init__(self):
13
        """Constructor test."""
14
        tested_object = AbstractStage()
15
        self.assertIsNotNone(tested_object)
16
17
    def test___init__arguments_passed(self):
18
        """Check arguments in constructor."""
19
        abstract_stage_mock = Mock()
20
        input_vector = (1, 2, 3)
21
        AbstractStage.__init__(abstract_stage_mock, input_vector)
22
        self.assertEqual(abstract_stage_mock.input_vector, input_vector)
23
24
    def test___init__output_mutability(self):
25
        """Check fields in object."""
26
        input_vector = [1, 2, 3]
27
        tested_object = AbstractStage(input_vector)
28
        tested_object.input_vector[2] += 1
29
        self.assertEqual(tested_object.input_vector[2], 4)
30
31
    def test_get_cost(self):
32
        """Check get_cost method."""
33
        tested_object = AbstractStage()
34
        with self.assertRaises(NotImplementedError):
35
            tested_object.get_cost()
36
37
    def test_get_quality(self):
38
        """Check get_quality method."""
39
        tested_object = AbstractStage()
40
        with self.assertRaises(NotImplementedError):
41
            tested_object.get_quality()
42
43
    def test_could_be_optimized(self):
44
        """Check could_be_optimized method."""
45
        tested_object = AbstractStage()
46
        with self.assertRaises(NotImplementedError):
47
            tested_object.could_be_optimized()
48
49
    def test_is_enough_quality(self):
50
        """Check is_enough_quality method."""
51
        tested_object = AbstractStage()
52
        with self.assertRaises(NotImplementedError):
53
            tested_object.is_enough_quality(7)
54
55
    def test_get_output_of_stage(self):
56
        """Check is_enough_quality method."""
57
        tested_object = AbstractStage()
58
        with self.assertRaises(NotImplementedError):
59
            tested_object.get_output_of_stage()
60
61
    def test_get_maximal_acceptable_cost(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_get_maximal_acceptable_cost does not conform to the method naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
62
        tested_object = AbstractStage()
63
        with self.assertRaises(NotImplementedError):
64
            tested_object.get_maximal_acceptable_cost()
65