Test Failed
Push — master ( 8192fe...83ef1f )
by Steffen
02:25
created

tests.files.test_constraint   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 35
dl 0
loc 80
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A TestConstraint.test_value_not_equals() 0 8 1
A TestConstraint.test_value_bigger() 0 8 1
A TestConstraint.test_value_equals() 0 8 1
A TestConstraint.test_value_smaller() 0 8 1
A TestConstraint.test_value_bigger_or_equal() 0 8 1
A TestConstraint.test_value_smaller_or_equal() 0 8 1
A TestConstraint.test_constraint() 0 8 1
1
#!/usr/bin/python
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
# -*- coding: utf-8 -*-
3
import unittest
4
5
from saucenao.files.constraint import Constraint
6
7
8
class TestConstraint(unittest.TestCase):
0 ignored issues
show
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
9
    """
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
10
    test cases for the constraints in the files submodule
11
    """
12
13
    def test_constraint(self):
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
14
        """Test the initializing function of Constraint
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
15
16
        :return:
17
        """
18
        constraint = Constraint(value='Value', cmp_func=self)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
19
        self.assertEqual(constraint.value, 'Value')
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
20
        self.assertEqual(constraint.cmp_func, self)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
21
22
    def test_value_bigger(self):
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
23
        """Test compare function cmp_value_bigger
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
24
25
        :return:
26
        """
27
        self.assertEqual(Constraint.cmp_value_bigger(1, 2), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
28
        self.assertEqual(Constraint.cmp_value_bigger(2, 2), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
29
        self.assertEqual(Constraint.cmp_value_bigger(2, 1), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
30
31
    def test_value_bigger_or_equal(self):
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
32
        """Test compare function cmp_value_bigger
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
33
34
        :return:
35
        """
36
        self.assertEqual(Constraint.cmp_value_bigger_or_equal(1, 2), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
37
        self.assertEqual(Constraint.cmp_value_bigger_or_equal(2, 2), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
38
        self.assertEqual(Constraint.cmp_value_bigger_or_equal(2, 1), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
39
40
    def test_value_smaller(self):
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
41
        """Test compare function cmp_value_bigger
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
42
43
        :return:
44
        """
45
        self.assertEqual(Constraint.cmp_value_smaller(1, 2), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
46
        self.assertEqual(Constraint.cmp_value_smaller(2, 2), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
47
        self.assertEqual(Constraint.cmp_value_smaller(2, 1), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
48
49
    def test_value_smaller_or_equal(self):
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
50
        """Test compare function cmp_value_bigger
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
51
52
        :return:
53
        """
54
        self.assertEqual(Constraint.cmp_value_smaller_or_equal(1, 2), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
55
        self.assertEqual(Constraint.cmp_value_smaller_or_equal(2, 2), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
56
        self.assertEqual(Constraint.cmp_value_smaller_or_equal(2, 1), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
57
58
    def test_value_equals(self):
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
59
        """Test compare function cmp_value_bigger
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
60
61
        :return:
62
        """
63
        self.assertEqual(Constraint.cmp_value_equals(1, 2), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
64
        self.assertEqual(Constraint.cmp_value_equals(2, 2), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
65
        self.assertEqual(Constraint.cmp_value_equals(2, 1), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
66
67
    def test_value_not_equals(self):
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
68
        """Test compare function cmp_value_bigger
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
69
70
        :return:
71
        """
72
        self.assertEqual(Constraint.cmp_value_not_equals(1, 2), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
73
        self.assertEqual(Constraint.cmp_value_not_equals(2, 2), False)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
74
        self.assertEqual(Constraint.cmp_value_not_equals(2, 1), True)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
75
76
77
if __name__ == '__main__':
78
    suite = unittest.TestLoader().loadTestsFromTestCase(TestConstraint)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
Coding Style Naming introduced by
The name suite does not conform to the constant naming conventions ((([A-Z_][A-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...
79
    unittest.TextTestRunner(verbosity=2).run(suite)
0 ignored issues
show
Coding Style introduced by
Found indentation with spaces instead of tabs
Loading history...
80