test: Pgvector - increase unit tests coverage - #3800
Draft
julian-risch wants to merge 1 commit into
Draft
Conversation
Contributor
Coverage report (pgvector)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. Ten SQL builders had no test reference at all, even though they return psycopg Composed objects and need no database. They are now asserted on the SQL they render, using the _render helper the filter tests already use: - table creation, HNSW index creation for both vector and halfvec types and their build parameters, and the insert statement for every DuplicatePolicy - the count, count-distinct, min/max and unique-values queries, including pagination, the ILIKE search term, and why the unique-values query uses -> rather than ->> so numbers sort numerically - the keyword retrieval query and the three rejections in _check_and_build_embedding_retrieval_query filters.py gains the scalar comparison operators: >, >=, <, <= with their ISO date handling and type rejections, in/not in, and like/not like. The not-in test pins the IS NULL clause that keeps rows missing the field. The database-facing methods run against mocked sync and async connections and cursors, asserting the SQL and parameters handed to execute, and covering the DuplicateDocumentError and DocumentStoreError paths. A second fixture patches only the db-setup methods, so _initialize_table, delete_table and _handle_hnsw — which the shared mock_store fixture patches away — are exercised too, including the warning when an HNSW index already exists. Every async twin is covered alongside its synchronous counterpart. _ensure_db_setup and its async twin are deliberately left to the integration tests. Unit coverage: 47% -> 92%. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
julian-risch
force-pushed
the
test/pgvector-unit-coverage
branch
from
August 18, 2026 09:26
28d4e08 to
85f7453
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:
vectorandhalfvectypes.filters.py(>,>=,<,<=,in,not in,like,not like)._initialize_table,delete_tableand_handle_hnsw— which the sharedmock_storefixture patches away — are exercised too.How did you test it?
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.