def test_set_none(self): matrix_node = obj.MatrixNode("ABCEDAD") matrix_node.set_value(None) self.assertEqual( matrix_node.get_value(), None, "The set_value method did not set the right None value")
def test_set_int(self): matrix_node = obj.MatrixNode(100) matrix_node.set_value(200) self.assertEqual( matrix_node.get_value(), 200, "The set_value method did not set the right int value")
def test_set_float(self): matrix_node = obj.MatrixNode("ABCEDAD") matrix_node.set_value(123.32) self.assertEqual( matrix_node.get_value(), 123.32, "The set_value method did not set the right None value")
def test_set_str(self): matrix_node = obj.MatrixNode("2300") matrix_node.set_value("ABCD") self.assertEqual( matrix_node.get_value(), "ABCD", "The set_value method did not set the right str value")
def test_initialize_with_next_down(self): # Create a MatrixNode object with a value, without defining value matrix_node = obj.MatrixNode(down=12.3, next=300) # Check if the value of the node and the pointers are correct self.assertEqual(matrix_node.get_value(), None, "The node value is not None") self.assertEqual( matrix_node.get_next(), 300, "The value of the next object is incorrect") self.assertEqual( matrix_node.get_down(), 12.3, "The value of the object below is incorrect")
def test_initialize_with_value_down(self): # Create a MatrixNode object with a value, without defining next value matrix_node = obj.MatrixNode(69, down="ABC") # Check if the value of the node and the pointers are correct self.assertEqual(matrix_node.get_value(), 69, "The node value is incorrect") self.assertEqual( matrix_node.get_next(), None, "The value of the next object is not None") self.assertEqual( matrix_node.get_down(), "ABC", "The value of the object below is incorrect")
def test_initialize_with_value_next_down(self): # Create a MatrixNode object with initializing values matrix_node = obj.MatrixNode('a', 100, 25) # Check if the value given to the node and the pointers are correct self.assertEqual(matrix_node.get_value(), 'a', "The node value is incorrect") self.assertEqual( matrix_node.get_next(), 100, "The value of the next object is incorrect") self.assertEqual( matrix_node.get_down(), 25, "The value of the object below is incorrect")
def test_initialize_with_down(self): # Create a MatrixNode object with a down, without defining value and down # values matrix_node = obj.MatrixNode(down="Nots") # Check if the value of the node and the pointers are correct self.assertEqual( matrix_node.get_value(), None, "The value of the value object is not None") self.assertEqual( matrix_node.get_next(), None, "The value of the next object is not None") self.assertEqual( matrix_node.get_down(), "Nots", "The value of the object below is incorrect")
def test_initialize_with_next(self): # Create a MatrixNode object with a next, without defining value and # bottom values matrix_node = obj.MatrixNode(next=69) # Check if the value of the node and the pointers are correct self.assertEqual( matrix_node.get_value(), None, "The value of the value object is not None") self.assertEqual( matrix_node.get_next(), 69, "The value of the next object is incorrect") self.assertEqual( matrix_node.get_down(), None, "The value of the object below is not None")