def test_insert_bottom_one_element_list(self): linked = LinkedList(['one']) linked.insert_to_the_bottom(2) self.assertEqual('one', linked.first_node.data) self.assertEqual(2, linked.first_node.next.data)
def test_insert_bottom_many_element_list(self): linked = LinkedList(['one', 'two', 3]) linked.insert_to_the_bottom(4.34) self.assertEqual(4.34, linked.get_node_with_value(4.34).data) self.assertEqual(None, linked.get_node_with_value(4.34).next) self.assertEqual("| one | -> | two | -> | 3 | -> | 4.34 | -> None", str(linked))
def test_insert_bottom_empty_list(self): linked = LinkedList([]) linked.insert_to_the_bottom('first') self.assertEqual('first', linked.first_node.data) self.assertEqual(None, linked.first_node.next)