Code Duplication    Length = 16-16 lines in 3 locations

tests/models/test_evc_base.py 3 locations

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