Exemple #1
0
 def test_list_with_non_existing_matching_element(self):
     lst = [1, 3, 5, 7]
     self.assertIsNone(utils.first_index(lst, lambda e: e == 2))
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
 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)