test: FAISS - increase unit tests coverage - #3795
Draft
julian-risch wants to merge 1 commit into
Draft
Conversation
Cover the code paths that were only reachable through the integration-marked tests, which the unit coverage badge excludes. FAISS runs in-process, so these need no mocks: they drive a real in-memory store and use tmp_path for persistence. - _check_condition: every logical and comparison operator, the missing-field and None-value short circuits, mixed int/float comparison, and all eleven FilterError paths - _get_doc_value: content, id, meta. prefix, attribute fallback, and unknown fields - search: ranking, the 1/(1+distance) score for a Flat index, top_k, post-retrieval filtering, the -1 padding FAISS returns when top_k exceeds the index size, and that the stored document is not mutated - write_documents OVERWRITE and SKIP policies, delete_documents, delete_all_documents, and their effect on the index - the metadata aggregation family, including documents missing the field - save/load round trip, the missing-file error, and the out-of-sync warning - to_dict/from_dict on both the store and the retriever - the retriever's run, filter policies, and run_async run_async had no test at all because pytest-asyncio was missing from the test environment; it is added here. Unit coverage: 32% -> 99%. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Coverage report (faiss)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes:
_check_condition(the filter matcher, was 24%),searchscoring and the-1padding, the write and delete policies, the metadata aggregation family, andsave/load. FAISS runs in-process, so these drive a real store and need no mocks.pytest-asyncioto the test environment;FAISSEmbeddingRetriever.run_asynchad no test at all because the dependency was missing.test_check_condition_invalid_structure_raises_filter_errorfromtest_document_store.py; its four cases are a subset of the new parametrized version.How did you test it?
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.