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

bears.tests.general.LineLengthBearTest.setUp()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 4
rs 10
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