def test_insert_last_node_empty_list(self): dl_list = DoublyLinkedList() self.assertEqual(len([i for i in dl_list.items()]), 0) dl_list.insertLastNode(1) self.assertEqual(dl_list.lastnode().value, 1) self.assertEqual(len([i for i in dl_list.items()]), 1)
def test_insert_last_node(self): dl_list = DoublyLinkedList([1, 2, 3]) self.assertEqual(len([i for i in dl_list.items()]), 3) dl_list.insertLastNode(4) self.assertEqual(dl_list.lastnode().value, 4) self.assertEqual(len([i for i in dl_list.items()]), 4)