Skip to content

Commit a3803ee

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2cf9d92 commit a3803ee

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

data_structures/kd_tree/tests/test_kdtree.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
@pytest.mark.parametrize(
1111
"num_points, cube_size, num_dimensions, depth, expected_result",
1212
[
13-
(0, 10.0, 2, 0, None), # Empty points list
14-
(10, 10.0, 2, 2, KDNode), # Depth = 2, 2D points
13+
(0, 10.0, 2, 0, None), # Empty points list
14+
(10, 10.0, 2, 2, KDNode), # Depth = 2, 2D points
1515
(10, 10.0, 3, -2, KDNode), # Depth = -2, 3D points
1616
],
1717
)
@@ -24,11 +24,13 @@ def test_build_kdtree(num_points, cube_size, num_dimensions, depth, expected_res
2424
- Positive depth value.
2525
- Negative depth value.
2626
"""
27-
points = hypercube_points(num_points, cube_size, num_dimensions).tolist() \
28-
if num_points > 0 \
27+
points = (
28+
hypercube_points(num_points, cube_size, num_dimensions).tolist()
29+
if num_points > 0
2930
else []
31+
)
3032

31-
kdtree = build_kdtree(points, depth = depth)
33+
kdtree = build_kdtree(points, depth=depth)
3234

3335
if expected_result is None:
3436
# Empty points list case
@@ -38,11 +40,14 @@ def test_build_kdtree(num_points, cube_size, num_dimensions, depth, expected_res
3840
assert kdtree is not None, "Expected a KDNode, got None"
3941

4042
# Check if root has correct dimensions
41-
assert len(kdtree.point) == num_dimensions, \
42-
f"Expected point dimension {num_dimensions}, got {len(kdtree.point)}"
43+
assert (
44+
len(kdtree.point) == num_dimensions
45+
), f"Expected point dimension {num_dimensions}, got {len(kdtree.point)}"
4346

4447
# Check that the tree is balanced to some extent (simplistic check)
45-
assert isinstance(kdtree, KDNode), f"Expected KDNode instance, got {type(kdtree)}"
48+
assert isinstance(
49+
kdtree, KDNode
50+
), f"Expected KDNode instance, got {type(kdtree)}"
4651

4752

4853
def test_nearest_neighbour_search():

0 commit comments

Comments
 (0)