def test_linear_search(self): array = [1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 6, 6, 6] self.assertEqual(6, linear_search(array, 4)) self.assertEqual(10, linear_search(array, 5)) self.assertEqual(-1, linear_search(array, 7)) self.assertEqual(-1, linear_search(array, -1))
from algorithms.search import linear_search import random alist = [random.randint(1, 10) for i in range(100)] print(alist) print(linear_search(alist, 5))