Code Duplication    Length = 15-15 lines in 6 locations

tests/test_models.py 3 locations

@@ 178-192 (lines=15) @@
175
            evc.update(**update_dict)
176
        self.assertEqual(str(handle_error.exception), error_message)
177
178
    def test_update_uni_z(self):
179
        """Test if raises and error when trying to update the uni_z."""
180
        attributes = {
181
            "name": "circuit_name",
182
            "uni_a": get_uni_mocked(is_valid=True),
183
            "uni_z": get_uni_mocked(is_valid=True)
184
        }
185
        update_dict = {
186
            "uni_z": get_uni_mocked(is_valid=True)
187
        }
188
        error_message = "uni_z can't be be updated."
189
        with self.assertRaises(ValueError) as handle_error:
190
            evc = EVC(**attributes)
191
            evc.update(**update_dict)
192
        self.assertEqual(str(handle_error.exception), error_message)
193
194
    def test_circuit_representation(self):
195
        """Test the method __repr__."""
@@ 162-176 (lines=15) @@
159
            evc.update(**update_dict)
160
        self.assertEqual(str(handle_error.exception), error_message)
161
162
    def test_update_uni_a(self):
163
        """Test if raises and error when trying to update the uni_a."""
164
        attributes = {
165
            "name": "circuit_name",
166
            "uni_a": get_uni_mocked(is_valid=True),
167
            "uni_z": get_uni_mocked(is_valid=True)
168
        }
169
        update_dict = {
170
            "uni_a": get_uni_mocked(is_valid=True)
171
        }
172
        error_message = "uni_a can't be be updated."
173
        with self.assertRaises(ValueError) as handle_error:
174
            evc = EVC(**attributes)
175
            evc.update(**update_dict)
176
        self.assertEqual(str(handle_error.exception), error_message)
177
178
    def test_update_uni_z(self):
179
        """Test if raises and error when trying to update the uni_z."""
@@ 146-160 (lines=15) @@
143
            EVC(**attributes)
144
        self.assertEqual(str(handle_error.exception), error_message)
145
146
    def test_update_name(self):
147
        """Test if raises and error when trying to update the name."""
148
        attributes = {
149
            "name": "circuit_name",
150
            "uni_a": get_uni_mocked(is_valid=True),
151
            "uni_z": get_uni_mocked(is_valid=True)
152
        }
153
        update_dict = {
154
            "name": "circuit_name_2"
155
        }
156
        error_message = "name can't be be updated."
157
        with self.assertRaises(ValueError) as handle_error:
158
            evc = EVC(**attributes)
159
            evc.update(**update_dict)
160
        self.assertEqual(str(handle_error.exception), error_message)
161
162
    def test_update_uni_a(self):
163
        """Test if raises and error when trying to update the uni_a."""

tests/models/test_evc_base.py 3 locations

@@ 100-114 (lines=15) @@
97
            evc.update(**update_dict)
98
        self.assertEqual(str(handle_error.exception), error_message)
99
100
    def test_update_uni_z(self):
101
        """Test if raises and error when trying to update the uni_z."""
102
        attributes = {
103
            "name": "circuit_name",
104
            "uni_a": get_uni_mocked(is_valid=True),
105
            "uni_z": get_uni_mocked(is_valid=True)
106
        }
107
        update_dict = {
108
            "uni_z": get_uni_mocked(is_valid=True)
109
        }
110
        error_message = "uni_z can't be be updated."
111
        with self.assertRaises(ValueError) as handle_error:
112
            evc = EVC(**attributes)
113
            evc.update(**update_dict)
114
        self.assertEqual(str(handle_error.exception), error_message)
115
116
    def test_circuit_representation(self):
117
        """Test the method __repr__."""
@@ 84-98 (lines=15) @@
81
            evc.update(**update_dict)
82
        self.assertEqual(str(handle_error.exception), error_message)
83
84
    def test_update_uni_a(self):
85
        """Test if raises and error when trying to update the uni_a."""
86
        attributes = {
87
            "name": "circuit_name",
88
            "uni_a": get_uni_mocked(is_valid=True),
89
            "uni_z": get_uni_mocked(is_valid=True)
90
        }
91
        update_dict = {
92
            "uni_a": get_uni_mocked(is_valid=True)
93
        }
94
        error_message = "uni_a can't be be updated."
95
        with self.assertRaises(ValueError) as handle_error:
96
            evc = EVC(**attributes)
97
            evc.update(**update_dict)
98
        self.assertEqual(str(handle_error.exception), error_message)
99
100
    def test_update_uni_z(self):
101
        """Test if raises and error when trying to update the uni_z."""
@@ 68-82 (lines=15) @@
65
            EVC(**attributes)
66
        self.assertEqual(str(handle_error.exception), error_message)
67
68
    def test_update_name(self):
69
        """Test if raises and error when trying to update the name."""
70
        attributes = {
71
            "name": "circuit_name",
72
            "uni_a": get_uni_mocked(is_valid=True),
73
            "uni_z": get_uni_mocked(is_valid=True)
74
        }
75
        update_dict = {
76
            "name": "circuit_name_2"
77
        }
78
        error_message = "name can't be be updated."
79
        with self.assertRaises(ValueError) as handle_error:
80
            evc = EVC(**attributes)
81
            evc.update(**update_dict)
82
        self.assertEqual(str(handle_error.exception), error_message)
83
84
    def test_update_uni_a(self):
85
        """Test if raises and error when trying to update the uni_a."""