@@ -40,7 +40,11 @@ async def test_embedding_status_vector_tables_missing(
4040 """When vector tables don't exist, recommend reindex."""
4141 # Drop the chunks table created by the fixture to simulate missing vector tables
4242 # Postgres requires CASCADE (due to index dependencies); SQLite doesn't support it
43- drop_sql = "DROP TABLE IF EXISTS search_vector_chunks CASCADE" if _is_postgres () else "DROP TABLE IF EXISTS search_vector_chunks"
43+ drop_sql = (
44+ "DROP TABLE IF EXISTS search_vector_chunks CASCADE"
45+ if _is_postgres ()
46+ else "DROP TABLE IF EXISTS search_vector_chunks"
47+ )
4448 await project_service .repository .execute_query (text (drop_sql ), {})
4549
4650 with patch .object (
@@ -112,9 +116,7 @@ async def test_embedding_status_orphaned_chunks(
112116 # SQLite queries join on rowid which aliases INTEGER PRIMARY KEY.
113117 await project_service .repository .execute_query (
114118 text (
115- "CREATE TABLE IF NOT EXISTS search_vector_embeddings ("
116- " chunk_id INTEGER PRIMARY KEY"
117- ")"
119+ "CREATE TABLE IF NOT EXISTS search_vector_embeddings ( chunk_id INTEGER PRIMARY KEY)"
118120 ),
119121 {},
120122 )
@@ -141,14 +143,10 @@ async def test_embedding_status_orphaned_chunks(
141143
142144
143145@pytest .mark .asyncio
144- async def test_embedding_status_healthy (
145- project_service : ProjectService , test_graph , test_project
146- ):
146+ async def test_embedding_status_healthy (project_service : ProjectService , test_graph , test_project ):
147147 """When all entities have embeddings, no reindex recommended."""
148148 # Clear any leftover data from prior tests
149- await project_service .repository .execute_query (
150- text ("DELETE FROM search_vector_chunks" ), {}
151- )
149+ await project_service .repository .execute_query (text ("DELETE FROM search_vector_chunks" ), {})
152150
153151 # Drop any existing virtual table (may have been created by search_service init)
154152 # and recreate as a simple regular table for testing the join logic.
@@ -158,19 +156,13 @@ async def test_embedding_status_healthy(
158156 text ("DROP TABLE IF EXISTS search_vector_embeddings" ), {}
159157 )
160158 await project_service .repository .execute_query (
161- text (
162- "CREATE TABLE search_vector_embeddings ("
163- " chunk_id INTEGER PRIMARY KEY"
164- ")"
165- ),
159+ text ("CREATE TABLE search_vector_embeddings ( chunk_id INTEGER PRIMARY KEY)" ),
166160 {},
167161 )
168162
169163 # Insert a chunk + matching embedding for every search_index entity
170164 entity_result = await project_service .repository .execute_query (
171- text (
172- "SELECT DISTINCT entity_id FROM search_index WHERE project_id = :project_id"
173- ),
165+ text ("SELECT DISTINCT entity_id FROM search_index WHERE project_id = :project_id" ),
174166 {"project_id" : test_project .id },
175167 )
176168 entity_ids = [row [0 ] for row in entity_result .fetchall ()]
0 commit comments