Test edge cases such as an empty KD-Tree.
()
| 86 | |
| 87 | |
| 88 | def test_edge_cases(): |
| 89 | """ |
| 90 | Test edge cases such as an empty KD-Tree. |
| 91 | """ |
| 92 | empty_kdtree = build_kdtree([]) |
| 93 | query_point = [0.0] * 2 # Using a default 2D query point |
| 94 | |
| 95 | nearest_point, nearest_dist, nodes_visited = nearest_neighbour_search( |
| 96 | empty_kdtree, query_point |
| 97 | ) |
| 98 | |
| 99 | # With an empty KD-Tree, nearest_point should be None |
| 100 | assert nearest_point is None |
| 101 | assert nearest_dist == float("inf") |
| 102 | assert nodes_visited == 0 |
| 103 | |
| 104 | |
| 105 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected