| Total Complexity | 4 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| 1 | import sys |
||
| 12 | class PEP8BearTest(LocalBearTestHelper): |
||
|
|
|||
| 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 | |||
| 39 |
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.