From 40db8c205f2b233dde2fa6735e6a9a752862f98c Mon Sep 17 00:00:00 2001 From: poloso Date: Wed, 7 Oct 2020 09:27:19 -0500 Subject: [PATCH] Fix: Corrected test. List in test must be ordered. (#2632) * Fix: Corrected test. List in test must be ordered. * Add tests with big lists. --- searches/simple_binary_search.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/searches/simple_binary_search.py b/searches/simple_binary_search.py index 8495dda8d..d1f7f7a51 100644 --- a/searches/simple_binary_search.py +++ b/searches/simple_binary_search.py @@ -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