| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| 1 | from queue import Queue |
||
| 12 | class LineLengthBearTest(LocalBearTestHelper): |
||
| 13 | |||
| 14 | def setUp(self): |
||
| 15 | self.section = Section("test section") |
||
| 16 | self.section.append(Setting("max_line_length", "4")) |
||
| 17 | self.uut = LineLengthBear(self.section, Queue()) |
||
| 18 | |||
| 19 | def test_run(self): |
||
| 20 | self.assertLinesValid(self.uut, [ |
||
| 21 | "test\n", |
||
| 22 | "too\n", |
||
| 23 | "er\n", |
||
| 24 | "e\n", |
||
| 25 | "\n" |
||
| 26 | ]) |
||
| 27 | self.assertLineInvalid(self.uut, "testa\n") |
||
| 28 | self.assertLineInvalid(self.uut, "test line\n") |
||
| 29 | |||
| 30 | def test_ignore_regex(self): |
||
| 31 | self.section['ignore_length_regex'] = r'http:\/\/' |
||
| 32 | |||
| 33 | self.assertLineInvalid(self.uut, 'asdasd') |
||
| 34 | self.assertLineValid(self.uut, 'http://a.domain.de') |
||
| 35 | |||
| 39 |