Completed
Pull Request — master (#1116)
by Lasse
01:39
created

bears.tests.general.LineLengthBearTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %
Metric Value
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A test_run() 0 10 1
1
from queue import Queue
2
import sys
3
4
sys.path.insert(0, ".")
5
import unittest
6
from coalib.settings.Setting import Setting
7
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
8
from coalib.settings.Section import Section
9
from bears.general.LineLengthBear import LineLengthBear
10
11
12
class LineLengthBearTest(LocalBearTestHelper):
13
    def setUp(self):
14
        self.section = Section("test section")
15
        self.section.append(Setting("max_line_length", "4"))
16
        self.uut = LineLengthBear(self.section, Queue())
17
18
    def test_run(self):
19
        self.assertLinesValid(self.uut, [
20
            "test\n",
21
            "too\n",
22
            "er\n",
23
            "e\n",
24
            "\n"
25
        ])
26
        self.assertLineInvalid(self.uut, "testa\n")
27
        self.assertLineInvalid(self.uut, "test line\n")
28
29
30
if __name__ == '__main__':
31
    unittest.main(verbosity=2)
32