Completed
Push — master ( 40c094...b6a1c4 )
by Wojtek
02:30
created

TestOptimizationController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A test_should_continue_when_no_failed() 0 3 1
A setUp() 0 7 1
A test_should_stop_when_one_failed() 0 3 1
A test_should_stop_when_all_success() 0 3 1
1
from unittest import TestCase
0 ignored issues
show
Coding Style Naming introduced by
The name test_optimizationController does not conform to the module naming conventions ((([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$).

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 module 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...
2
from unittest.mock import Mock
3
4
from grortir.main.model.core.optimization_status import OptimizationStatus
5
from grortir.main.pso.optimization_controller import OptimizationController
6
7
8
class TestOptimizationController(TestCase):
0 ignored issues
show
Coding Style introduced by
This class 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...
9
    def setUp(self):
10
        self.stage_success = Mock()
11
        self.stage_success.optimization_status = OptimizationStatus.success
12
        self.stage_failed = Mock()
13
        self.stage_failed.optimization_status = OptimizationStatus.failed
14
        self.stage_in_progress = Mock()
15
        self.stage_in_progress.optimization_status = OptimizationStatus.in_progress
16
17
    def test_should_stop_when_one_failed(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_should_stop_when_one_failed 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...
18
        self.assertFalse(OptimizationController.should_continue(
19
            [self.stage_success, self.stage_failed]))
20
21
    def test_should_continue_when_no_failed(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_should_continue_when_no_failed 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...
22
        self.assertTrue(OptimizationController.should_continue(
23
            [self.stage_success, self.stage_in_progress]))
24
25
    def test_should_stop_when_all_success(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_should_stop_when_all_success 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...
26
        self.assertFalse((OptimizationController.should_continue(
27
            [self.stage_success, self.stage_success])))
28