mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Remove useless code in doctests (#7733)
* refactor: Fix matrix display deprecation * refactor: Remove useless `print` and `pass` statements * revert: Replace broken doctests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * revert: Fix failing doctests * chore: Satisfy pre-commit Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
501a1cf0c7
commit
61eedc16c3
@ -13,25 +13,25 @@ from __future__ import annotations
|
||||
def binary_search(a_list: list[int], item: int) -> bool:
|
||||
"""
|
||||
>>> test_list = [0, 1, 2, 8, 13, 17, 19, 32, 42]
|
||||
>>> print(binary_search(test_list, 3))
|
||||
>>> binary_search(test_list, 3)
|
||||
False
|
||||
>>> print(binary_search(test_list, 13))
|
||||
>>> binary_search(test_list, 13)
|
||||
True
|
||||
>>> print(binary_search([4, 4, 5, 6, 7], 4))
|
||||
>>> binary_search([4, 4, 5, 6, 7], 4)
|
||||
True
|
||||
>>> print(binary_search([4, 4, 5, 6, 7], -10))
|
||||
>>> binary_search([4, 4, 5, 6, 7], -10)
|
||||
False
|
||||
>>> print(binary_search([-18, 2], -18))
|
||||
>>> binary_search([-18, 2], -18)
|
||||
True
|
||||
>>> print(binary_search([5], 5))
|
||||
>>> binary_search([5], 5)
|
||||
True
|
||||
>>> print(binary_search(['a', 'c', 'd'], 'c'))
|
||||
>>> binary_search(['a', 'c', 'd'], 'c')
|
||||
True
|
||||
>>> print(binary_search(['a', 'c', 'd'], 'f'))
|
||||
>>> binary_search(['a', 'c', 'd'], 'f')
|
||||
False
|
||||
>>> print(binary_search([], 1))
|
||||
>>> binary_search([], 1)
|
||||
False
|
||||
>>> print(binary_search([-.1, .1 , .8], .1))
|
||||
>>> binary_search([-.1, .1 , .8], .1)
|
||||
True
|
||||
>>> binary_search(range(-5000, 5000, 10), 80)
|
||||
True
|
||||
|
Reference in New Issue
Block a user