Completed
Pull Request — master (#1073)
by Lasse
01:56
created

bears.tests.Python.PEP8BearTest.test_valid()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 3
rs 10
1
import sys
2
import unittest
3
from queue import Queue
4
5
sys.path.insert(0, ".")
6
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
7
from bears.Python.PEP8Bear import PEP8Bear
8
from coalib.settings.Section import Section
9
from coalib.settings.Setting import Setting
10
11
12
class PEP8BearTest(LocalBearTestHelper):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
    def setUp(self):
14
        self.section = Section('name')
15
        self.uut = PEP8Bear(self.section, Queue())
16
17
    def test_valid(self):
18
        self.assertLinesValid(self.uut, ["import sys"])
19
        self.assertLinesValid(self.uut, ["a = 1 + 1"])
20
21
    def test_disable_warnings(self):
22
        self.assertLinesInvalid(self.uut, ['def func():\n',
23
                                           '    pass\n',
24
                                           'def func2():\n',
25
                                           '    pass\n'])
26
        self.section.append(Setting('pep_ignore', 'E302'))
27
        self.assertLinesValid(self.uut, ['def func():\n',
28
                                         '    pass\n',
29
                                         'def func2():\n',
30
                                         '    pass\n'])
31
32
    def test_invalid(self):
33
        self.assertLinesInvalid(self.uut, [""])
34
        self.assertLinesInvalid(self.uut, ["a=1+1"])
35
36
37
if __name__ == '__main__':
38
    unittest.main(verbosity=2)
39