Code Duplication    Length = 12-12 lines in 4 locations

tests/version/test_update_pyproject_version.py 4 locations

@@ 68-79 (lines=12) @@
65
66
        self.assertEqual(toml['tool']['poetry']['version'], '20.4.dev1')
67
68
    def test_override_existing_version(self):
69
        fake_path_class = MagicMock(spec=Path)
70
        fake_path = fake_path_class.return_value
71
        fake_path.read_text.return_value = '[tool.poetry]\nversion = "1.2.3"'
72
73
        update_pyproject_version('20.04dev1', pyproject_toml_path=fake_path)
74
75
        text = fake_path.write_text.call_args[0][0]
76
77
        toml = tomlkit.parse(text)
78
79
        self.assertEqual(toml['tool']['poetry']['version'], '20.4.dev1')
80
@@ 55-66 (lines=12) @@
52
53
        self.assertEqual(toml['tool']['poetry']['version'], '20.4.dev1')
54
55
    def test_empty_tool_poetry_section(self):
56
        fake_path_class = MagicMock(spec=Path)
57
        fake_path = fake_path_class.return_value
58
        fake_path.read_text.return_value = "[tool.poetry]"
59
60
        update_pyproject_version('20.04dev1', pyproject_toml_path=fake_path)
61
62
        text = fake_path.write_text.call_args[0][0]
63
64
        toml = tomlkit.parse(text)
65
66
        self.assertEqual(toml['tool']['poetry']['version'], '20.4.dev1')
67
68
    def test_override_existing_version(self):
69
        fake_path_class = MagicMock(spec=Path)
@@ 42-53 (lines=12) @@
39
40
        self.assertEqual(toml['tool']['poetry']['version'], '20.4.dev1')
41
42
    def test_empty_tool_section(self):
43
        fake_path_class = MagicMock(spec=Path)
44
        fake_path = fake_path_class.return_value
45
        fake_path.read_text.return_value = "[tool]"
46
47
        update_pyproject_version('20.04dev1', pyproject_toml_path=fake_path)
48
49
        text = fake_path.write_text.call_args[0][0]
50
51
        toml = tomlkit.parse(text)
52
53
        self.assertEqual(toml['tool']['poetry']['version'], '20.4.dev1')
54
55
    def test_empty_tool_poetry_section(self):
56
        fake_path_class = MagicMock(spec=Path)
@@ 29-40 (lines=12) @@
26
27
28
class UpdatePyprojectVersionTestCase(unittest.TestCase):
29
    def test_empty_pyproject_toml(self):
30
        fake_path_class = MagicMock(spec=Path)
31
        fake_path = fake_path_class.return_value
32
        fake_path.read_text.return_value = ""
33
34
        update_pyproject_version('20.04dev1', pyproject_toml_path=fake_path)
35
36
        text = fake_path.write_text.call_args[0][0]
37
38
        toml = tomlkit.parse(text)
39
40
        self.assertEqual(toml['tool']['poetry']['version'], '20.4.dev1')
41
42
    def test_empty_tool_section(self):
43
        fake_path_class = MagicMock(spec=Path)