Total Complexity | 7 |
Total Lines | 30 |
Duplicated Lines | 100 % |
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 | # pylint: disable=attribute-defined-outside-init |
||
45 | View Code Duplication | class TestShowLog: |
|
46 | |||
47 | def setup_method(self, _): |
||
48 | _Config.indent_level = 0 |
||
49 | _Config.verbosity = 1 |
||
50 | self.log = Mock() |
||
51 | |||
52 | def test_show(self): |
||
53 | common.show("Hello, world!", log=self.log) |
||
54 | |||
55 | assert [ |
||
56 | call.info("Hello, world!"), |
||
57 | ] == self.log.mock_calls |
||
58 | |||
59 | def test_show_after_indent(self): |
||
60 | common.indent() |
||
61 | common.show("|\n", log=self.log) |
||
62 | |||
63 | assert [ |
||
64 | call.info("|"), |
||
65 | ] == self.log.mock_calls |
||
66 | |||
67 | def test_show_after_1_indent_2_dedent(self): |
||
68 | common.indent() |
||
69 | common.dedent() |
||
70 | common.dedent() |
||
71 | common.show("|\n", log=self.log) |
||
72 | |||
73 | assert [ |
||
74 | call.info("|"), |
||
75 | ] == self.log.mock_calls |
||
91 |