sdd / kiddo

Kiddo
Apache License 2.0
87 stars 14 forks source link

Added test to capture edge cases with unsorted count #180

Open ezrasingh opened 1 month ago

ezrasingh commented 1 month ago

Description

This PR introduces a new test to handle edge cases when querying for nearest_n_within. The test is designed to ensure that the nearest_n_within function behaves as expected, particularly with the max_qty and sorted parameters.

Key Changes:

Confirmation of Fix:

This test confirms that the fix introduced in PR #175 for issue #168 works as intended.

However, it also reveals that the function behaves differently when max_qty is set to 0, depending on whether the results are sorted or not. When sorted is true, the function handles max_qty = 0 correctly, but when sorted is false, it fails to return the expected empty result set.

This addition helps to ensure that edge cases are handled correctly and that the nearest_n_within function performs consistently under various conditions.