test: Weaviate - increase unit tests coverage - #3798
Draft
julian-risch wants to merge 2 commits into
Draft
Conversation
Contributor
Coverage report (weaviate)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
Cover the code paths that were only reachable through the integration-marked tests, which the unit coverage badge excludes. _filters.py went from 41% to 100%. Its whole operator table was untested: _handle_date, _contains, _match_no_document and validate_filters had no references anywhere. These filters are built entirely client-side, so no Weaviate server is involved: - every comparison operator, the is_none rewrites for None values, the extra is_none clause != needs so documents missing the property still match, ISO date normalisation, and every FilterError path - AND, OR, nesting, and the De Morgan rewrite that stands in for NOT Because Weaviate's composite filters have no __eq__, the tests compare a description of the filter tree, so each one states the whole expected filter instead of poking at attributes. For document_store.py, the collection-backed methods are driven by injecting a mock collection, which the collection properties return as-is: _clean_connection_settings, _compute_field_unique_values, _to_data_object/_to_document (blob base64, named vectors, datetimes, bm25 score vs embedding certainty), the metadata-info family, filtered and unfiltered queries, write for every DuplicatePolicy, delete and delete_all including batching, update_by_filter, the three retrieval methods, the DocumentStoreError wrapping, and every async twin. Client construction is deliberately left to the integration tests. Unit coverage: 47% -> 95%. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
julian-risch
force-pushed
the
test/weaviate-unit-coverage
branch
from
August 18, 2026 09:26
a275ed0 to
94dc0ab
Compare
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:
_filters.pywas at 41% with its whole operator table untested. Cover every comparison and logical operator, theis_nonerewrites, ISO date normalisation, and the De Morgan rewrite that stands in forNOT. The tests compare a description of the filter tree, since Weaviate's composite filters have no__eq__._clean_connection_settings,_compute_field_unique_valuesand_to_data_object/_to_document, plus the metadata-info family, write/delete/update and the retrieval methods, by injecting a mock collection.How did you test it?
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.