Raise error not string (#7945)

* ci: Add `B023` to `.flake8` ignores

* refactor: Return `bool`/raise Exception

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Remove previous branch commit

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* feat: Apply `__repr__` changes

* chore: Fix failing tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* test: Fix doctests

* random.choice(population_score[:N_SELECTED])[0]

* Update basic_string.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
Caeden Perelli-Harris
2022-11-06 14:54:44 +00:00
committed by GitHub
parent 51708530b6
commit daa1c7529a
14 changed files with 123 additions and 120 deletions

View File

@ -24,11 +24,11 @@ class Node:
"""
>>> node = Node(length=27)
>>> repr(node)
'min_value: -1, max_value: -1'
'Node(min_value=-1 max_value=-1)'
>>> repr(node) == str(node)
True
"""
return f"min_value: {self.minn}, max_value: {self.maxx}"
return f"Node(min_value={self.minn} max_value={self.maxx})"
def build_tree(arr: list[int]) -> Node | None:
@ -37,7 +37,7 @@ def build_tree(arr: list[int]) -> Node | None:
of the constructed tree
>>> build_tree(test_array)
min_value: 0, max_value: 9
Node(min_value=0 max_value=9)
"""
root = Node(len(arr))
root.minn, root.maxx = min(arr), max(arr)