-
-
Notifications
You must be signed in to change notification settings - Fork 44.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bhavesh9908/Building a KD-Tree from Points #11547
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
This comment was marked as duplicate.
This comment was marked as duplicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I have already implemented this in #11532
Is there something wrong with the test?
|
||
if expected_result is None: | ||
# Empty points list case | ||
assert kdtree is None, f"Expected None for empty points list, got {kdtree}" | ||
else: | ||
# Check if root node is not None | ||
# Check if KD-Tree is built correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original comment is: Check if root node is not None
. It matches the test being made.
assert isinstance( | ||
kdtree, KDNode | ||
), f"Expected KDNode instance, got {type(kdtree)}" | ||
assert ( | ||
len(kdtree.point) == num_dimensions | ||
), f"Expected point dimension {num_dimensions}, got {len(kdtree.point)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, is this just reordering tests?
""" | ||
points = ( | ||
hypercube_points(num_points, cube_size, num_dimensions).tolist() | ||
if num_points > 0 | ||
else [] | ||
) | ||
|
||
kdtree = build_kdtree(points, depth=depth) | ||
kdtree = build_kdtree(points) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are always calling build_kdtree()
with the default case depth = 0
. This is not going to test it correctly.
Checklist: