Completed
Push — master ( b48796...33ca96 )
by Wojtek
02:06
created

TestVelocityCalculator.test_calculate()   A

Complexity

Conditions 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
1
from unittest import TestCase
0 ignored issues
show
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.pso.velocity_calculator import VelocityCalculator
5
6
7
class TestVelocityCalculator(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...
8
    def test_calculate(self):
0 ignored issues
show
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...
9
        stage = Mock()
10
        tested_object = VelocityCalculator()
11
        current_velocities = {stage: [0.5, 0.5]}
12
        particle_best_positions = {stage: [0.5, 0.5]}
13
        leader_best_positions = {stage: [0.5, 0.5]}
14
        control_params = {stage: [0.5, 0.5]}
15
        result = tested_object.calculate(current_velocities,
16
                                         particle_best_positions,
17
                                         leader_best_positions,
18
                                         control_params)
19
        self.assertIsInstance(result[stage], type([1, 2]))
20
        self.assertEquals(len(result), 1)
21