| Total Complexity | 5 |
| Total Lines | 21 |
| Duplicated Lines | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | import unittest |
||
| 13 | View Code Duplication | class FileWiseBearTest(unittest.TestCase): |
|
|
|
|||
| 14 | |||
| 15 | def setUp(self): |
||
| 16 | file_set = {DummyFileProxy([]), DummyFileProxy(["a\n"])} |
||
| 17 | self.test_object = FileWiseBear(file_set, Section("Name"), None) |
||
| 18 | |||
| 19 | def test_api(self): |
||
| 20 | test_object = FileWiseBear(None, Section("name"), None) |
||
| 21 | self.assertRaises(NotImplementedError, |
||
| 22 | test_object.analyze, |
||
| 23 | "file") |
||
| 24 | |||
| 25 | def test_kind(self): |
||
| 26 | self.assertEqual(FileWiseBear.kind(), BEAR_KIND.FILEWISE) |
||
| 27 | |||
| 28 | def test_bear_executions(self): |
||
| 29 | for task in self.test_object.generate_tasks(): |
||
| 30 | self.assertRaises(NotImplementedError, |
||
| 31 | self.test_object.execute_task, |
||
| 32 | task[0], |
||
| 33 | task[1]) |
||
| 34 |