Fix: Corrected test. List in test must be ordered. (#2632)

* Fix: Corrected test. List in test must be ordered.

* Add tests with big lists.
This commit is contained in:
poloso 2020-10-07 09:27:19 -05:00 committed by GitHub
parent c14cfa32df
commit 40db8c205f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,8 +31,14 @@ def binary_search(a_list: list[int], item: int) -> bool:
False
>>> print(binary_search([], 1))
False
>>> print(binary_search([.1, .4 , -.1], .1))
>>> print(binary_search([-.1, .1 , .8], .1))
True
>>> binary_search(range(-5000, 5000, 10), 80)
True
>>> binary_search(range(-5000, 5000, 10), 1255)
False
>>> binary_search(range(0, 10000, 5), 2)
False
"""
if len(a_list) == 0:
return False