def test_list_with_non_existing_matching_element(self): lst = [1, 3, 5, 7] self.assertIsNone(utils.first_index(lst, lambda e: e == 2))
def test_list_with_non_existing_matching_element(self): lst = [1, 3, 5, 7] self.assertEqual(utils.first_index(lst, lambda e: e == 2), None)
def test_list_with_existing_matching_element(self): lst = [1, 3, 5, 7] self.assertEqual(utils.first_index(lst, lambda e: e == 1), 0) self.assertEqual(utils.first_index(lst, lambda e: e == 5), 2) self.assertEqual(utils.first_index(lst, lambda e: e == 7), 3)