def test_search_whenItemIsAvailable_returnsNode(self): sl = SingleLinkedList() sl.add(1) sl.add(2) item1 = sl.search(1) item2 = sl.search(2) self.assertTrue(item1.value == 1) self.assertTrue(item2.value == 2)
def test_search_whenItemIsNotAvailable_returnsFalse(self): sl = SingleLinkedList() sl.add(1) item2 = sl.search(2) self.assertEqual(item2, False)
def test_search_whenHeadIsNone_returnsFalse(self): sl = SingleLinkedList() returnValue = sl.search(1) self.assertEqual(False, returnValue)