def test_remove_last_1(self): """ Tests the removal of last node in a list with one node """ l = LinkedList() l.insert_first("a") l.remove_last() self.assertEqual(l.head, None)
def test_remove_last_3(self): """ Tests the removal of last node in a list with three nodes """ l = LinkedList() l.insert_first("c") l.insert_first("b") l.insert_first("a") l.remove_last() self.assertEqual(l.size(), 2) self.assertEqual(l.get_last().data, "b")
def test_remove_last_2(self): """ Tests the removal of last node in a list with two nodes """ l = LinkedList() l.insert_first("b") l.insert_first("a") l.remove_last() self.assertEqual(l.size(), 1) self.assertEqual(l.get_last().data, "a") self.assertEqual(l.get_last().next, None)
def test_remove_last_empty(self): """ Tests the return of None when run on empty list """ l = LinkedList() self.assertEqual(l.remove_last(), None)