To test our function we can use following test function that generates sample sorted array and random index to test our function.
import random
def test():
datasize = 10
data = list(set([random.randrange(0,50,1)]) for x in range(datasize))
key = data[random.randrange(0, len(data), 1)]
found = binarySearch(data, key)
print ("sample data")
print ("size : ", datasize)
print ("data : ", data)
print ("searchkey: ", key)
print ("found : ", found)