mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-22 21:28:12 +02:00
chore: linting
This commit is contained in:
parent
0a012dbc79
commit
ce952d2ad1
127 changed files with 821 additions and 517 deletions
|
|
@ -135,8 +135,6 @@ async def test_agent_checkpoint_round_trips_across_turns(
|
|||
{"messages": [HumanMessage(content="second turn")]}, config
|
||||
)
|
||||
|
||||
texts = [
|
||||
m.content for m in second["messages"] if isinstance(m, HumanMessage)
|
||||
]
|
||||
texts = [m.content for m in second["messages"] if isinstance(m, HumanMessage)]
|
||||
assert "remember apple" in texts, "turn 1 history not reloaded from checkpoint"
|
||||
assert len(second["messages"]) > len(first["messages"])
|
||||
|
|
|
|||
|
|
@ -45,9 +45,7 @@ def _build_desktop_fs_mw(root: Path):
|
|||
"""Build the production filesystem middleware bound to a real local folder."""
|
||||
selection = FilesystemSelection(
|
||||
mode=FilesystemMode.DESKTOP_LOCAL_FOLDER,
|
||||
local_mounts=(
|
||||
LocalFilesystemMount(mount_id=_MOUNT_ID, root_path=str(root)),
|
||||
),
|
||||
local_mounts=(LocalFilesystemMount(mount_id=_MOUNT_ID, root_path=str(root)),),
|
||||
)
|
||||
resolver = build_backend_resolver(selection)
|
||||
return build_filesystem_mw(
|
||||
|
|
@ -157,7 +155,7 @@ async def test_write_then_ls_lists_file(tmp_path: Path):
|
|||
|
||||
async def test_edit_file_rewrites_on_disk(tmp_path: Path):
|
||||
"""edit_file applies a real string replacement to the on-disk file."""
|
||||
result = await _run(
|
||||
await _run(
|
||||
tmp_path,
|
||||
[
|
||||
ScriptedTurn(
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@ from app.indexing_pipeline.adapters.file_upload_adapter import UploadDocumentAda
|
|||
pytestmark = pytest.mark.integration
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_sets_status_ready(db_session, db_search_space, db_user, mocker):
|
||||
"""Document status is READY after successful indexing."""
|
||||
adapter = UploadDocumentAdapter(db_session)
|
||||
|
|
@ -29,9 +27,7 @@ async def test_sets_status_ready(db_session, db_search_space, db_user, mocker):
|
|||
assert DocumentStatus.is_state(document.status, DocumentStatus.READY)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_content_is_source_markdown(db_session, db_search_space, db_user, mocker):
|
||||
"""Document content is set to the extracted source markdown."""
|
||||
adapter = UploadDocumentAdapter(db_session)
|
||||
|
|
@ -51,9 +47,7 @@ async def test_content_is_source_markdown(db_session, db_search_space, db_user,
|
|||
assert document.content == "## Hello\n\nSome content."
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_chunks_written_to_db(db_session, db_search_space, db_user, mocker):
|
||||
"""Chunks derived from the source markdown are persisted in the DB."""
|
||||
adapter = UploadDocumentAdapter(db_session)
|
||||
|
|
@ -98,9 +92,7 @@ async def test_raises_on_indexing_failure(db_session, db_search_space, db_user,
|
|||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_reindex_updates_content(db_session, db_search_space, db_user, mocker):
|
||||
"""Document content is updated to the new source markdown after reindexing."""
|
||||
adapter = UploadDocumentAdapter(db_session)
|
||||
|
|
@ -126,9 +118,7 @@ async def test_reindex_updates_content(db_session, db_search_space, db_user, moc
|
|||
assert document.content == "## Edited\n\nNew content after user edit."
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_reindex_updates_content_hash(
|
||||
db_session, db_search_space, db_user, mocker
|
||||
):
|
||||
|
|
@ -157,9 +147,7 @@ async def test_reindex_updates_content_hash(
|
|||
assert document.content_hash != original_hash
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_reindex_sets_status_ready(db_session, db_search_space, db_user, mocker):
|
||||
"""Document status is READY after successful reindexing."""
|
||||
adapter = UploadDocumentAdapter(db_session)
|
||||
|
|
@ -222,9 +210,7 @@ async def test_reindex_replaces_chunks(db_session, db_search_space, db_user, moc
|
|||
assert chunks[0].content == "Updated chunk."
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_reindex_clears_reindexing_flag(
|
||||
db_session, db_search_space, db_user, mocker
|
||||
):
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@ def _cal_doc(
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_calendar_pipeline_creates_ready_document(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
@ -65,9 +63,7 @@ async def test_calendar_pipeline_creates_ready_document(
|
|||
assert DocumentStatus.is_state(row.status, DocumentStatus.READY)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_calendar_legacy_doc_migrated(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ def _drive_doc(
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_drive_pipeline_creates_ready_document(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
@ -64,9 +62,7 @@ async def test_drive_pipeline_creates_ready_document(
|
|||
assert DocumentStatus.is_state(row.status, DocumentStatus.READY)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_drive_legacy_doc_migrated(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ def _dropbox_doc(
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_dropbox_pipeline_creates_ready_document(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
@ -63,9 +61,7 @@ async def test_dropbox_pipeline_creates_ready_document(
|
|||
assert DocumentStatus.is_state(row.status, DocumentStatus.READY)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_dropbox_duplicate_content_skipped(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
|
|||
|
|
@ -36,9 +36,7 @@ def _gmail_doc(
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_gmail_pipeline_creates_ready_document(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
@ -68,9 +66,7 @@ async def test_gmail_pipeline_creates_ready_document(
|
|||
assert row.source_markdown == doc.source_markdown
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_gmail_legacy_doc_migrated_then_reused(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ from app.indexing_pipeline.indexing_pipeline_service import IndexingPipelineServ
|
|||
pytestmark = pytest.mark.integration
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_index_batch_creates_ready_documents(
|
||||
db_session, db_search_space, make_connector_document, mocker
|
||||
):
|
||||
|
|
@ -49,9 +47,7 @@ async def test_index_batch_creates_ready_documents(
|
|||
assert row.embedding is not None
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_index_batch_empty_returns_empty(db_session, mocker):
|
||||
"""index_batch with empty input returns an empty list."""
|
||||
service = IndexingPipelineService(session=db_session)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ def _onedrive_doc(
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_onedrive_pipeline_creates_ready_document(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
@ -63,9 +61,7 @@ async def test_onedrive_pipeline_creates_ready_document(
|
|||
assert DocumentStatus.is_state(row.status, DocumentStatus.READY)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_onedrive_duplicate_content_skipped(
|
||||
db_session, db_search_space, db_connector, db_user, mocker
|
||||
):
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ async def test_new_document_is_persisted_with_pending_status(
|
|||
assert reloaded.source_markdown == doc.source_markdown
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_unchanged_ready_document_is_skipped(
|
||||
db_session,
|
||||
db_search_space,
|
||||
|
|
@ -55,9 +53,7 @@ async def test_unchanged_ready_document_is_skipped(
|
|||
assert results == []
|
||||
|
||||
|
||||
@pytest.mark.usefixtures(
|
||||
"patched_embed_texts", "patched_chunk_text"
|
||||
)
|
||||
@pytest.mark.usefixtures("patched_embed_texts", "patched_chunk_text")
|
||||
async def test_title_only_change_updates_title_in_db(
|
||||
db_session,
|
||||
db_search_space,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ async def test_comment_reply_truncates_long_preview(
|
|||
db_session: AsyncSession, db_user: User, db_search_space: SearchSpace
|
||||
):
|
||||
"""A long comment preview is truncated in the reply message."""
|
||||
notification = await _notify(db_session, db_user, db_search_space, preview="y" * 150)
|
||||
notification = await _notify(
|
||||
db_session, db_user, db_search_space, preview="y" * 150
|
||||
)
|
||||
|
||||
assert notification.message == "y" * 100 + "..."
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from datetime import UTC, datetime, timedelta
|
|||
import pytest
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.db import SearchSpace, User
|
||||
from app.db import User
|
||||
from app.notifications.persistence import Notification
|
||||
|
||||
pytestmark = pytest.mark.integration
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ async def test_new_mention_truncates_long_preview(
|
|||
db_session: AsyncSession, db_user: User, db_search_space: SearchSpace
|
||||
):
|
||||
"""A long comment preview is truncated in the mention message."""
|
||||
notification = await _notify(db_session, db_user, db_search_space, preview="x" * 150)
|
||||
notification = await _notify(
|
||||
db_session, db_user, db_search_space, preview="x" * 150
|
||||
)
|
||||
|
||||
assert notification.message == "x" * 100 + "..."
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue