test: add unit tests for local sparse-vector helpers#1256
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthroughThis PR adds a new test file, tests/test_sparse.py, containing pytest-based tests for Qdrant's local sparse-vector utility functions. The tests cover empty_sparse_vector creation, validate_sparse_vector acceptance and rejection scenarios (length mismatch, NaN values, duplicate indices), is_sorted behavior on empty, single-element, sorted, and unsorted vectors, and sort_sparse_vector correctness including an identity short-circuit case for already-sorted input. Estimated code review effort: 2 (Simple) | ~10 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
qdrant_client/local/sparse.pyholds the client-side sparse-vectorhelpers but had no dedicated test module (only incidental use in fixtures).
This adds
tests/test_sparse.pycovering:empty_sparse_vector()producing emptyindices/valuesvalidate_sparse_vector()accepting a well-formed vector and raisingAssertionErroron length mismatch, NaN values, and duplicate indicesis_sorted()on empty/single-element and sorted vs. unsorted inputssort_sparse_vector()ordering indices while carrying values along, andreturning the input unchanged when it is already sorted
No source changes.
Verification
pytest tests/test_sparse.py- 9 passed.ruff check/ruff format --checkclean.