def test_remove_first(self): sll = Singlellist([1, 2, 3]) sll.remove_first() self.assertEqual(sll[0], 2) sll.remove_first() self.assertEqual(sll[0], 3) sll.remove_first() self.assertEqual(sll.is_empty(), True)
def test_remove_all(self): sll = Singlellist([1, 1, 2, 3, 3]) sll.remove_all(1) self.assertEqual(str(sll), "SLL[2, 3, 3]") sll.remove_all(3) self.assertEqual(str(sll), "SLL[2]") sll.remove_all(2) self.assertEqual(sll.is_empty(), True)
def test_empty(self): sll = Singlellist() self.assertEqual(sll.is_empty(), True) sll.add_first(1) self.assertEqual(sll.is_empty(), False)