def testFindIndex(self): lst = [1, 2, 3] self.assertEqual(1, find_index(lst, 2)) self.assertEqual(2, find_index(lst, 3))
def testFindIndexWithPredicate(self): lst = [1, 2, 3] self.assertEqual(1, find_index(lst, predicate=lambda i: i % 2 == 0)) self.assertEqual(0, find_index(lst, predicate=lambda i: i % 2 == 1))