Completed
Pull Request — master (#57)
by Wojtek
08:12
created

TestVelocityCalculator   A

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 typing import List
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...
Configuration introduced by
The import typing could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
2
from unittest import TestCase
3
from unittest.mock import Mock
4
5
from grortir.main.pso.velocity_calculator import VelocityCalculator
6
7
8
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...
9
    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...
10
        stage = Mock()
11
        tested_object = VelocityCalculator()
12
        current_velocities = {stage: [0.5, 0.5]}
13
        particle_best_positions = {stage: [0.5, 0.5]}
14
        leader_best_positions = {stage: [0.5, 0.5]}
15
        control_params = {stage: [0.5, 0.5]}
16
        result = tested_object.calculate(current_velocities,
17
                                         particle_best_positions,
18
                                         leader_best_positions,
19
                                         control_params)
20
        self.assertIsInstance(result[stage], List)
21
        self.assertEquals(len(result), 1)
22