def test_remove_whenElemIsTail_returnsRemovedNode(self): sl = SingleLinkedList() sl.add(1) sl.add(2) sl.add(3) removed = sl.remove(3) self.assertEqual(removed.value, 3)
def test_remove_whenElemInMiddle_returnsRemovedNode(self): sl = SingleLinkedList() sl.add(11) sl.add(32) sl.add(44) sl.add(99) removedNode = sl.remove(44) self.assertTrue(removedNode.value, 44)
def test_remove_whenElemNotPresent_returnsFalse(self): sl = SingleLinkedList() removed = sl.remove(1) self.assertFalse(removed)