TestVelocityCalculator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_calculate() 0 13 1
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