repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
DeepTutor
tests/services/config/test_embedding_runtime.py
.py
"""Tests for normalized embedding runtime resolution.""" from __future__ import annotations import pytest from deeptutor.services.config.provider_runtime import ( EMBEDDING_PROVIDERS, resolve_embedding_runtime_config, ) NATIVE_GEMINI2_ENDPOINT = ( "https://generativelanguage.googleapis.com/v1beta/models...
416
14,106
DeepTutor
tests/services/config/test_context_window_detection.py
.py
from __future__ import annotations import asyncio from deeptutor.services.config import context_window_detection as detection_module from deeptutor.services.config.context_window_detection import ( detect_context_window, ) from deeptutor.services.llm.config import LLMConfig def _config(**overrides): default...
149
4,482
DeepTutor
tests/services/config/test_provider_runtime.py
.py
"""Tests for TutorBot-style runtime config adapter.""" from __future__ import annotations from deeptutor.services.config.provider_runtime import ( SEARCH_PROVIDERS, resolve_llm_runtime_config, resolve_search_runtime_config, search_fallback_candidates, search_missing_credential, search_provider...
715
23,879
DeepTutor
tests/services/config/test_pageindex_settings.py
.py
"""PageIndex credential storage in RuntimeSettingsService.""" from __future__ import annotations from pathlib import Path from deeptutor.services.config.runtime_settings import RuntimeSettingsService def test_pageindex_settings_roundtrip(tmp_path: Path) -> None: svc = RuntimeSettingsService(tmp_path, process_e...
38
1,418
DeepTutor
tests/services/config/test_catalog_env_overlay.py
.py
"""Regression: project-root .env must not overlay model catalog profiles.""" from __future__ import annotations import json from pathlib import Path from typing import Any import pytest from deeptutor.services.config.model_catalog import ModelCatalogService def _write_env(path: Path, lines: list[str]) -> None: ...
266
9,812
DeepTutor
tests/services/config/test_llm_probe_config.py
.py
"""Tests for LLM diagnostic probe max_tokens configuration via agents.yaml.""" from __future__ import annotations from pathlib import Path import textwrap from typing import Any from unittest.mock import AsyncMock, patch import pytest import yaml from deeptutor.services.config import loader as loader_module from de...
359
13,559
DeepTutor
tests/services/config/test_chat_params_config.py
.py
"""Tests for chat capability per-stage token configuration via agents.yaml.""" from __future__ import annotations from pathlib import Path from typing import Any import yaml from deeptutor.services.config import loader as loader_module from deeptutor.services.config.loader import ( DEFAULT_CHAT_PARAMS, get_...
189
7,062
DeepTutor
tests/services/config/test_runtime_settings.py
.py
from __future__ import annotations import json from pathlib import Path from deeptutor.services.config.runtime_settings import ( RuntimeSettingsService, ensure_runtime_settings_files, ) RUNTIME_ENV_KEYS = ( "BACKEND_PORT", "FRONTEND_PORT", "NEXT_PUBLIC_API_BASE_EXTERNAL", "PUBLIC_API_BASE", ...
484
18,733
DeepTutor
tests/services/config/test_graphrag_lightrag_settings.py
.py
"""GraphRAG + LightRAG engine knobs stored in RuntimeSettingsService.""" from __future__ import annotations from pathlib import Path from deeptutor.services.config.runtime_settings import RuntimeSettingsService def test_graphrag_defaults_and_clamp(tmp_path: Path) -> None: svc = RuntimeSettingsService(tmp_path,...
71
2,697
DeepTutor
tests/services/config/test_embedding_endpoint.py
.py
"""Tests for exact, user-visible embedding endpoint normalization.""" from deeptutor.services.config.embedding_endpoint import ( embedding_endpoint_validation_error, gemini_embedding_endpoint, normalize_embedding_endpoint_for_display, redact_embedding_endpoint_for_display, ) def test_gemini_native_en...
129
4,506
DeepTutor
tests/services/config/test_test_runner_dim_autofill.py
.py
"""Verify the embedding test-connection behavior. Contract (post-simplification): the API probe is the single source of truth. * Every successful probe overwrites the catalog dim with the detected value and emits ``active_dim_source = "detected"`` — regardless of what was in the catalog before. Matryoshka users w...
444
16,355
DeepTutor
tests/services/model_selection/test_llm_selection.py
.py
from deeptutor.services.model_selection import ( LLMSelection, apply_llm_selection_to_catalog, list_llm_options, ) def _catalog(): return { "version": 1, "services": { "llm": { "active_profile_id": "p1", "active_model_id": "m1", ...
89
3,485
DeepTutor
tests/services/session/test_context_builder.py
.py
"""Tests for the ContextBuilder and its helper functions.""" from __future__ import annotations from typing import Any from unittest.mock import AsyncMock, MagicMock, patch import pytest from deeptutor.services.session.context_builder import ( ContextBuilder, ContextBuildResult, build_history_text, ...
472
17,707
DeepTutor
tests/services/session/test_source_inventory.py
.py
"""Unit tests for the cumulative source inventory used by the chat capability.""" from __future__ import annotations from typing import Any import pytest from deeptutor.services.session.source_inventory import ( SourceEntry, SourceInventory, build_inventory, render_manifest, serialize_referenced...
507
16,987
DeepTutor
tests/services/session/test_regenerate.py
.py
"""Tests for the chat regenerate-last-turn flow. Covers the SQLite store helpers added for tail rollback as well as the ``TurnRuntimeManager.regenerate_last_turn`` orchestration: assistant tail deletion, user-message preservation, ``_persist_user_message`` propagation, busy/empty session rejection, and skipping the lo...
408
15,668
DeepTutor
tests/services/session/test_import_session.py
.py
"""Tests for importing external chat histories into the session store. Imported conversations share the session tables with native chats (so the chat loop can re-open and continue them) but carry an ``imported_`` id prefix that keeps them in their own category and out of the regular history list. """ from __future__ ...
97
3,333
DeepTutor
tests/services/session/test_sqlite_store.py
.py
from __future__ import annotations import asyncio from pathlib import Path import sqlite3 import pytest from deeptutor.services.path_service import PathService from deeptutor.services.session.sqlite_store import SQLiteSessionStore def test_sqlite_store_defaults_to_data_user_chat_history_db(tmp_path: Path) -> None:...
268
10,509
DeepTutor
tests/services/session/test_pocketbase_isolation.py
.py
"""Per-user session isolation on the PocketBase backend (issue #596). PocketBase is a single shared server with no filesystem-level isolation, so ``PocketBaseSessionStore`` must scope every session row by ``user_id`` (derived from the request-scoped current-user ContextVar). These tests stand up a tiny in-memory fake ...
175
6,024
DeepTutor
tests/services/session/test_turn_event_flush.py
.py
"""Post-stream turn-event flush: batching, workspace mirror, PocketBase upload. The turn runtime buffers every live event in memory and persists the whole batch after the stream drains, right before publishing DONE. Everything on that path must stay O(1) round-trips w.r.t. the event count — per-event commits/opens/POS...
276
10,282
DeepTutor
tests/services/session/test_turn_runtime.py
.py
"""Tests for TurnRuntimeManager helper functions and lightweight behaviour.""" from __future__ import annotations import pytest from deeptutor.core.stream import StreamEvent, StreamEventType from deeptutor.services.session.turn_runtime import ( _assemble_persisted_answer, _clip_text, _extract_followup_qu...
320
11,834
DeepTutor
tests/services/session/test_artifact_attachments.py
.py
"""Tests for generated-artifact attachment records.""" from __future__ import annotations from pathlib import Path import zipfile import pytest from deeptutor.core.stream import StreamEvent, StreamEventType from deeptutor.services.session.artifact_attachments import ( _resolve_artifact_path, artifact_attach...
212
8,362
DeepTutor
tests/services/session/test_turn_runtime_subscribe.py
.py
from __future__ import annotations import asyncio import pytest from deeptutor.core.stream import StreamEvent, StreamEventType from deeptutor.services.session.sqlite_store import SQLiteSessionStore from deeptutor.services.session.turn_runtime import ( TurnRuntimeManager, _resolve_turn_outcome, _TurnExecu...
150
4,532
DeepTutor
tests/services/session/test_turn_runtime_title.py
.py
from __future__ import annotations from deeptutor.services.session.turn_runtime import _sanitize_session_title def test_sanitize_session_title_removes_reasoning_block() -> None: raw = "<think>\nNeed a concise title.\n</think>\n标题:AgenticRAG 定义" assert _sanitize_session_title(raw) == "AgenticRAG 定义" def te...
16
507
DeepTutor
tests/services/cron/test_cron_service.py
.py
"""CronService: scheduling math, persistence, scheduler loop, owner scoping.""" from __future__ import annotations import asyncio import time import pytest from deeptutor.services.cron.service import ( CronOwner, CronSchedule, CronService, compute_next_run, validate_schedule, ) def _now_ms() -...
173
6,293
DeepTutor
tests/services/cron/test_cron_tool.py
.py
"""The built-in ``cron`` tool: schema contract, owner injection, actions.""" from __future__ import annotations import time import pytest from deeptutor.services.cron.service import CronService from deeptutor.tools.cron_tool import run_cron_action @pytest.fixture def cron_service(tmp_path, monkeypatch): impor...
266
9,348
DeepTutor
tests/services/mcp/test_secrets.py
.py
"""MCP credentials: stored apart from the config, never echoed, resolved late.""" from __future__ import annotations from pathlib import Path import stat import sys import pytest from deeptutor.services.mcp.secrets import ( configured_fields, delete_secrets, resolve_references, resolve_url_reference...
180
7,014
DeepTutor
tests/services/mcp/test_pageindex_server.py
.py
"""Built-in pageindex MCP server injection.""" from __future__ import annotations from deeptutor.services.mcp import pageindex_server from deeptutor.services.mcp.config import MCPConfig, MCPServerConfig from deeptutor.services.mcp.manager import wrapped_tool_name from deeptutor.services.rag.pipelines.pageindex.config...
69
2,524
DeepTutor
tests/services/mcp/test_mcp_config.py
.py
"""MCP config: transport auto-detection, tool filtering, SSRF URL guard, wrapped names.""" from __future__ import annotations import pytest from deeptutor.services.mcp.config import MCPConfig, MCPServerConfig from deeptutor.services.mcp.manager import wrapped_tool_name from deeptutor.services.mcp.network import vali...
94
3,395
DeepTutor
tests/services/mcp/test_progress_reporting.py
.py
"""An MCP server's progress notifications, on their way to the trace. A long MCP call — a crawl, a render, a big query — is the case where a static spinner is the whole of what a reader gets. The server already tells us how far along it is; these tests pin that we ask for that, and that every shape a server may send s...
270
9,454
DeepTutor
tests/services/mcp/test_oauth.py
.py
"""MCP OAuth: where the grant lives, and who is allowed to complete one. A refresh token here authorises *a person's* account on a third-party service, so the properties worth pinning are about isolation and about which callbacks may finish a flow — not about the protocol, which is the SDK's. """ from __future__ impo...
273
10,797
DeepTutor
tests/services/mcp/test_catalog.py
.py
"""Curated MCP catalog: data integrity, credential targeting, search/pagination.""" from __future__ import annotations import json from pathlib import Path from typing import Any import pytest from deeptutor.services.mcp.catalog import loader from deeptutor.services.mcp.catalog.loader import ( category_counts, ...
630
23,750
DeepTutor
tests/services/mcp/test_manager_scopes.py
.py
"""Owner-scoped MCP connections: routing, containment, and bounds. Connections are keyed ``(owner, server_name)`` because two accounts may legitimately name a server the same thing. If a tool call resolved by name alone it would reach whichever session happened to be registered under it — executing against another per...
276
9,785
DeepTutor
tests/services/mcp/test_user_config.py
.py
"""A user's own MCP servers: where they live, and what is refused. Two invariants carry the whole self-service feature. The file must sit outside every tree the exec sandbox mounts (otherwise another account's shell can edit which credentials this account's server injects), and a user must not be able to ask for a ``s...
173
6,872
DeepTutor
tests/services/mcp/test_call_failures.py
.py
"""Two ways an MCP server can be wrong about its own state. Both cases here shipped as silent failures, and both were expensive to diagnose because the symptom named the wrong thing: * rotating a credential left every live session using the *old* key, because the reload diff fingerprints a config that stores ``${se...
303
11,064
DeepTutor
tests/services/cli_apps/test_provider.py
.py
"""Who may call an installed app, and what the model sees when they may. ``authorized_apps`` is the whole access policy for CLI apps, deliberately apart from the MCP allowlist because the two key on different things (app ids vs. tool names). Every row of its matrix is pinned here, including the two "available to nobod...
528
20,133
DeepTutor
tests/services/cli_apps/test_catalog.py
.py
"""The vendored snapshot itself: it ships in the package, so it is tested like code. A re-sync of ``vendor/catalog.json`` is a data change that can silently alter what this deployment will execute. These tests are the review that data gets. """ from __future__ import annotations import json from deeptutor.services....
156
5,986
DeepTutor
tests/services/cli_apps/test_installer.py
.py
"""Installing: the one action in this feature that runs code outside the sandbox. Every step's argv is asserted, because the point of the parser is that we build these commands rather than executing a catalog field. The subprocess itself is stubbed — a test that really ran ``pip install git+…`` would be a network test...
287
10,776
DeepTutor
tests/services/cli_apps/test_models.py
.py
"""The install-command parser, which is where the catalog stops being trusted. Every entry's ``install_cmd`` is third-party text. The parser's job is to turn the shapes we know how to run into an argv we build, and to refuse everything else *visibly*. These tests pin both halves — the recognition and the refusal — bec...
171
6,217
DeepTutor
tests/services/cli_apps/test_state_and_paths.py
.py
"""Where installs and preferences live, and what that placement has to guarantee. The layout is the security design, not an implementation detail: an app the sandbox can rewrite is a persistence primitive, and a preference the sandbox can rewrite is a way to switch on an app for the next turn. These tests pin the two ...
198
7,021
DeepTutor
tests/services/cli_apps/conftest.py
.py
"""Redirect every root a CLI app touches into ``tmp_path``. Two roots, because the feature deliberately splits its state across two trees: installs under ``data/cli-apps`` (the sandbox reads it) and per-account preferences under ``data/system`` (the sandbox never sees it). A test that redirected only one would write t...
29
1,105
DeepTutor
tests/services/memory/test_merge.py
.py
"""Tests for the merge mode (footnote consolidation, no-LLM).""" from __future__ import annotations from pathlib import Path import pytest from deeptutor.services.memory import paths as paths_mod from deeptutor.services.memory.consolidator.modes import merge as merge_mod from deeptutor.services.memory.document impo...
260
9,273
DeepTutor
tests/services/memory/test_store.py
.py
from __future__ import annotations import asyncio from pathlib import Path import pytest from deeptutor.services.memory import paths, store from deeptutor.services.memory.store import ( MemoryStore, migrate_partner_surface_if_needed, migrate_v1_if_needed, ) from deeptutor.services.memory.trace import Tra...
284
9,767
DeepTutor
tests/services/memory/test_snapshot_adapters.py
.py
"""Snapshot adapter tests — focus on the partner-conversation bridge. Partner runtimes persist their conversations as JSONL under ``<admin>/partners/<id>/sessions/*.jsonl`` (a store separate from the chat-history SQLite DB). ``read_partner_entities`` bridges those files into the ``partner`` memory surface so they cons...
142
5,302
DeepTutor
tests/services/memory/test_consolidator.py
.py
from __future__ import annotations from deeptutor.services.memory.consolidator import ( _filter_banned, _has_banned, _parse_ops_response, ) from deeptutor.services.memory.ops import AddOp, DeleteOp, EditOp def test_has_banned_catches_english_absolutes() -> None: assert _has_banned("user deeply unders...
74
2,475
DeepTutor
tests/services/memory/test_update_facts_json.py
.py
"""Regression: memory update fact JSON tolerates trailing brace prose.""" from __future__ import annotations from deeptutor.services.memory.consolidator.modes import update as update_mode def test_parse_facts_tolerates_trailing_brace_prose() -> None: raw = '{"facts":[{"text":"hello","section":"Notes","refs":["a...
14
489
DeepTutor
tests/services/memory/test_document.py
.py
from __future__ import annotations from deeptutor.services.memory.document import Document, Entry, parse, serialize _SAMPLE = """\ # Chat memory ## Misconceptions - Student misreads "for all ε" as "for some ε"[^m_01HZK4ABCDEFGHJKMNPQRSTVWX] - Forgets to multiply by g'(x) in chain rule[^m_01HZK5ABCDEFGHJKMNPQRSTVWX] ...
238
7,219
DeepTutor
tests/services/memory/test_ids.py
.py
from __future__ import annotations import time from deeptutor.services.memory.ids import ( is_entry_id, is_shortname_ref, is_trace_id, is_valid_ref, new_entry_id, new_trace_id, new_ulid, ) def test_ulid_length_and_charset() -> None: u = new_ulid() assert len(u) == 26 assert a...
71
2,087
DeepTutor
tests/services/memory/test_chunker.py
.py
"""Tests for the character-based chunker with boundary expansion.""" from __future__ import annotations import pytest from deeptutor.services.memory.consolidator.chunker import ( ChunkSpan, chunk_with_boundary, ) def test_empty_input_returns_no_chunks() -> None: assert ( chunk_with_boundary( ...
115
3,865
DeepTutor
tests/services/memory/test_ops.py
.py
from __future__ import annotations from deeptutor.services.memory.document import Document, Entry, parse from deeptutor.services.memory.ops import AddOp, ApplyReport, DeleteOp, EditOp, apply _BASE_MD = """\ # Chat memory ## Misconceptions - Original text[^m_01HZK4ABCDEFGHJKMNPQRSTVWX] --- [^m_01HZK4ABCDEFGHJKMNPQR...
160
4,975
DeepTutor
tests/services/memory/test_meta_settings.py
.py
"""Tests for meta.json sidecars + memory settings loader.""" from __future__ import annotations from unittest.mock import patch from deeptutor.services.memory.consolidator import meta as meta_mod from deeptutor.services.memory.settings import ( MemorySettings, load_memory_settings, save_memory_settings, ...
104
3,533
DeepTutor
tests/services/memory/test_modes.py
.py
"""End-to-end (LLM-mocked) tests for the three modes. These are the load-bearing tests for the new pipeline. The LLM call is mocked at the ``call_llm`` boundary in :mod:`modes._runtime`; everything else (chunker, ref validation, doc IO, meta) runs for real on a temp memory dir. """ from __future__ import annotations ...
316
11,930
DeepTutor
tests/services/memory/test_references.py
.py
"""Tests for ref pool validation and chunk-level concat helpers.""" from __future__ import annotations from deeptutor.services.memory.consolidator.references import ( ExtractedFact, refs_in_chunk_l2, refs_in_chunk_l3, refs_in_span_l2, render_l2_entries_for_concat, render_traces_for_concat, ...
160
5,419
DeepTutor
tests/services/memory/test_line_doc.py
.py
"""Tests for the line-numbered document view + edit application.""" from __future__ import annotations from deeptutor.services.memory.consolidator.line_doc import ( DeleteLinesOp, InsertAfterOp, ReplaceLineOp, apply_edits, parse_edits_payload, render_view, ) from deeptutor.services.memory.docu...
228
8,585
DeepTutor
tests/services/memory/test_runs.py
.py
"""Tests for the RunManager — start/cancel/replay semantics.""" from __future__ import annotations import asyncio import pytest from deeptutor.services.memory.consolidator.runs import ( RunBusyError, RunManager, push_undo_checkpoint, ) @pytest.fixture() def manager() -> RunManager: return RunManag...
150
4,803
DeepTutor
tests/services/codex_auth/test_service.py
.py
from __future__ import annotations import asyncio from copy import deepcopy import hashlib import json from pathlib import Path from typing import Any from urllib.parse import parse_qs, urlsplit import pytest from deeptutor.services.codex_auth import service as service_module from deeptutor.services.codex_auth.contr...
1,548
54,094
DeepTutor
tests/services/codex_auth/test_oauth.py
.py
from __future__ import annotations import asyncio import json from urllib.parse import parse_qs, urlsplit import httpx import pytest from deeptutor.services.codex_auth.constants import ( CODEX_OAUTH_CLIENT_ID, CODEX_OAUTH_SCOPE, ) from deeptutor.services.codex_auth.contracts import CodexAuthError, CodexCrede...
426
14,081
DeepTutor
tests/services/codex_auth/test_catalog.py
.py
from __future__ import annotations import json from pathlib import Path from typing import Any import httpx import pytest from deeptutor.services.codex_auth.catalog import CodexModelCatalog, parse_models_response from deeptutor.services.codex_auth.constants import ( CODEX_CLIENT_VERSION, CODEX_MAX_CATALOG_BY...
253
8,071
DeepTutor
tests/services/codex_auth/test_storage.py
.py
from __future__ import annotations from concurrent.futures import ThreadPoolExecutor import os from pathlib import Path import stat import pytest from deeptutor.services.codex_auth.contracts import CodexAuthError, CodexCredentials from deeptutor.services.codex_auth.storage import CodexCredentialStore def _credenti...
179
6,139
DeepTutor
tests/services/codex_auth/test_contracts.py
.py
from __future__ import annotations import base64 import json import pytest from deeptutor.services.codex_auth.constants import ( CODEX_CALLBACK_PORTS, CODEX_CLIENT_VERSION, CODEX_DEFAULT_MODEL, CODEX_MODELS_URL, CODEX_OAUTH_CLIENT_ID, ) from deeptutor.services.codex_auth.contracts import ( Ca...
195
5,540
DeepTutor
tests/services/codex_auth/test_credential_location.py
.py
"""Where a Codex login is stored on disk — and how an old one gets there. The sandbox runner bind-mounts the workspace subtrees (``docker-compose.yml``), and every authenticated account gets ``exec`` by default, so a refresh token kept inside a user root was readable by every other account. These tests pin the credent...
285
11,361
DeepTutor
tests/services/embedding/test_send_dimensions.py
.py
"""Tests for the tri-state ``send_dimensions`` opt-in. Covers: * ``OpenAICompatibleEmbeddingAdapter._should_send_dimensions`` (pure logic) * The actual HTTP payload assembled by ``embed()`` (verified via httpx mock) Tri-state semantics: * ``True`` → always send the ``dimensions`` request param * ``False`` → never ...
177
6,598
DeepTutor
tests/services/embedding/test_gemini_adapter.py
.py
"""Tests for Gemini native and legacy-compatible embedding requests.""" from __future__ import annotations import json from typing import Any import httpx import pytest from deeptutor.services.embedding.adapters.base import ( EmbeddingProviderError, EmbeddingRequest, ) from deeptutor.services.embedding.adap...
314
10,569
DeepTutor
tests/services/embedding/test_multimodal_request.py
.py
"""Verify EmbeddingRequest carries the multimodal contents/enable_fusion fields and that adapters route based on them.""" from __future__ import annotations from typing import Any import httpx import pytest from deeptutor.services.embedding.adapters.base import EmbeddingRequest from deeptutor.services.embedding.ada...
198
6,425
DeepTutor
tests/services/embedding/test_openai_sdk_adapter.py
.py
"""Tests for ``OpenAISDKEmbeddingAdapter``. The adapter wraps the official ``AsyncOpenAI`` client. Tests stub the SDK client itself rather than the underlying httpx layer — that way we verify the contract the adapter expects from the SDK (kwargs forwarded, response fields read) instead of pinning the SDK's internal UR...
214
7,739
DeepTutor
tests/services/embedding/test_client_runtime.py
.py
"""Tests for embedding client provider-backed execution path.""" from __future__ import annotations from typing import Any import pytest from deeptutor.services.embedding.client import ( EmbeddingClient, _resolve_adapter_class, get_embedding_client, reset_embedding_client, ) from deeptutor.services....
309
10,376
DeepTutor
tests/services/embedding/test_dashscope_adapter.py
.py
"""Tests for the DashScope (Aliyun) MultiModalEmbedding adapter.""" from __future__ import annotations import sys import types from typing import Any import pytest from deeptutor.services.embedding.adapters.base import EmbeddingRequest from deeptutor.services.embedding.adapters.dashscope_native import ( DashSco...
210
7,492
DeepTutor
tests/services/embedding/test_encoding_format.py
.py
"""Tests for the opt-in ``encoding_format`` request param. The dataclass default is ``None`` (see ``EmbeddingRequest``). Adapters then diverge on purpose: * ``OpenAICompatibleEmbeddingAdapter`` (gateways) OMITS the param unless the caller sets one explicitly — several gateways (e.g. SiliconFlow) return HTTP 400 w...
100
3,466
DeepTutor
tests/services/embedding/test_url_transparency.py
.py
"""Verify every embedding adapter posts to ``base_url`` VERBATIM. This guards the v1.3.0 contract: what the user types in the Settings UI is what hits the wire. No automatic ``/embeddings`` / ``/api/embed`` / ``/{api_version}/embed`` appending. Adapters get the URL once and use it. """ from __future__ import annotati...
209
7,138
DeepTutor
tests/services/embedding/test_extract_embeddings.py
.py
"""Tests for OpenAICompatibleEmbeddingAdapter._extract_embeddings_from_response.""" from __future__ import annotations import pytest from deeptutor.services.embedding.adapters.openai_compatible import ( OpenAICompatibleEmbeddingAdapter, ) _extract = OpenAICompatibleEmbeddingAdapter._extract_embeddings_from_resp...
177
6,293
DeepTutor
tests/services/embedding/test_qwen3_send_dimensions.py
.py
"""Verify the ``_should_send_dimensions`` heuristic recognizes Qwen3-Embedding and Qwen3-VL-Embedding model families (added in v1.3.0). """ from __future__ import annotations import pytest from deeptutor.services.embedding.adapters.openai_compatible import ( OpenAICompatibleEmbeddingAdapter, ) def _make(model:...
62
1,777
DeepTutor
tests/services/embedding/test_disable_ssl_verify.py
.py
"""DISABLE_SSL_VERIFY coverage for embedding adapters that use raw httpx. Companion to ``tests/services/llm/test_openai_http_client.py`` (SDK clients) and ``tests/services/llm/test_codex_disable_ssl_verify.py`` (codex retry path). Each adapter constructs ``httpx.AsyncClient`` directly; this asserts the ``verify`` kwar...
165
6,013
DeepTutor
tests/services/parsing/test_parse_service.py
.py
from __future__ import annotations from pathlib import Path import pytest from deeptutor.services.parsing import base, signature import deeptutor.services.parsing.service as svc_mod from deeptutor.services.parsing.service import ParseService from deeptutor.services.parsing.types import ParserError class _FakeParse...
117
3,863
DeepTutor
tests/services/parsing/test_signature.py
.py
from __future__ import annotations from deeptutor.services.parsing.signature import ParserSignature def test_hash_is_order_independent() -> None: a = ParserSignature.build("mineru", "2.0", {"mode": "local", "lang": "en"}) b = ParserSignature.build("mineru", "2.0", {"lang": "en", "mode": "local"}) assert ...
23
897
DeepTutor
tests/services/parsing/test_engines.py
.py
from __future__ import annotations from pathlib import Path import zipfile import pytest from deeptutor.services.parsing.engines import factory from deeptutor.services.parsing.types import ParserError def test_known_engines() -> None: assert factory.KNOWN_ENGINES == { "text_only", "mineru", ...
402
15,191
DeepTutor
tests/services/parsing/test_cache.py
.py
from __future__ import annotations import json from pathlib import Path from deeptutor.services.parsing import cache def test_source_hash_keys_on_bytes_not_name(tmp_path: Path) -> None: a = tmp_path / "a.pdf" a.write_bytes(b"hello") b = tmp_path / "b.pdf" # different name, same bytes b.write_bytes(...
108
3,982
DeepTutor
tests/services/partners/test_zulip_channel.py
.py
"""Unit tests for the Zulip channel implementation.""" from __future__ import annotations import asyncio from collections import deque from pathlib import Path import sys from types import SimpleNamespace from unittest.mock import AsyncMock, MagicMock, patch import pytest from deeptutor.partners.bus.queue import Me...
1,262
43,469
DeepTutor
tests/services/partners/test_channel_manager.py
.py
"""Unit tests for TutorBot channel dispatch behavior.""" from __future__ import annotations import asyncio from unittest.mock import AsyncMock import pytest from deeptutor.partners.bus.events import OutboundMessage from deeptutor.partners.channels.manager import ChannelManager from deeptutor.partners.config.schema ...
247
8,545
DeepTutor
tests/services/partners/test_napcat_channel.py
.py
"""Unit tests for the NapCat (OneBot v11) channel implementation.""" from __future__ import annotations from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch from pydantic import ValidationError import pytest from deeptutor.partners.bus.events import OutboundMessage from deeptutor.partners....
641
23,029
DeepTutor
tests/services/partners/test_partner_workspace.py
.py
"""Asset provisioning: copy KB / skill / notebook into the partner workspace.""" from __future__ import annotations import json from deeptutor.services.partners.workspace import ( ensure_partner_workspace, list_assets, provision_assets, remove_asset, strip_frontmatter, ) def _seed_admin_kb(admi...
186
6,796
DeepTutor
tests/services/partners/test_msteams_channel.py
.py
"""Unit tests for the Microsoft Teams channel implementation.""" from __future__ import annotations import json import time from unittest.mock import AsyncMock, MagicMock import pytest from deeptutor.partners.bus.events import OutboundMessage from deeptutor.partners.bus.queue import MessageBus from deeptutor.partne...
486
18,202
DeepTutor
tests/services/partners/test_split_message.py
.py
"""Regression tests for partners.helpers.split_message.""" from __future__ import annotations from deeptutor.partners.helpers import split_message def test_split_message_nonpositive_max_len_returns_unsplit() -> None: content = "hello world" assert split_message(content, max_len=0) == [content] assert sp...
18
531
DeepTutor
tests/services/partners/test_partner_memory_tools.py
.py
"""Partner-only memory + history tools. Covers the split-memory model: ``partner_memorize`` writes ONLY the partner's own memory (never the owner's), ``partner_read`` folds the owner's shared L3 on top of the partner's own, and ``partner_search`` greps the partner's sessions. """ from __future__ import annotations i...
141
5,572
DeepTutor
tests/services/partners/test_safe_filename.py
.py
"""Regression tests for partners.helpers.safe_filename.""" from __future__ import annotations from pathlib import Path from deeptutor.partners.helpers import safe_filename def test_safe_filename_strips_embedded_null_byte() -> None: cleaned = safe_filename("photo\x00.png") assert "\x00" not in cleaned a...
24
664
DeepTutor
tests/services/partners/test_weixin_channel.py
.py
"""Unit tests for the Weixin / personal WeChat partner channel.""" from __future__ import annotations import base64 import time from unittest.mock import AsyncMock, MagicMock import pytest from deeptutor.api.routers._partners_channel_schema import all_channel_schemas from deeptutor.partners.bus.events import Outbou...
344
12,419
DeepTutor
tests/services/partners/test_slugify_partner_id.py
.py
"""``slugify_partner_id`` must yield ASCII/URL-safe ids. Partner ids ride in ``/partners/<id>`` links and become on-disk directory names, so a non-Latin id (e.g. a raw CJK name) produced an unreachable link. These tests pin the ASCII-safe behavior and the stable per-name fallback used for names that have no ASCII char...
101
3,758
DeepTutor
tests/services/partners/test_channel_secrets.py
.py
"""Unit tests for channel-secret handling in the partner manager layer. These guard the contract that secret-looking fields (token, password, api_key, …) are NEVER serialised into responses unless the caller explicitly opts into ``include_secrets=True``. A regression here would re-introduce the token-leak fixed alongs...
224
7,625
DeepTutor
tests/services/partners/test_partner_runtime.py
.py
"""PartnerRunner: chat-loop event mapping, tool config, session persistence.""" from __future__ import annotations import asyncio from typing import Any import pytest from deeptutor.core.stream import StreamEvent, StreamEventType from deeptutor.partners.bus.events import InboundMessage from deeptutor.partners.bus.q...
737
31,002
DeepTutor
tests/services/partners/test_channel_streaming.py
.py
"""send_delta streaming contract for telegram / discord / feishu. Covers the shared protocol: first delta creates a message, later deltas edit in place (throttled), ``_stream_end`` renders the final text, and a new ``_stream_id`` opens a new message. """ from __future__ import annotations from types import SimpleNam...
192
7,634
DeepTutor
tests/services/partners/test_partner_manager_config.py
.py
"""PartnerManager config persistence, merge semantics, and legacy migration.""" from __future__ import annotations import dataclasses import yaml from deeptutor.services.partners.manager import PartnerConfig, PartnerManager from deeptutor.services.partners.workspace import DEFAULT_SOUL, read_soul def _mgr() -> Pa...
266
10,578
DeepTutor
tests/services/partners/test_mattermost_channel.py
.py
"""Unit tests for the Mattermost channel implementation.""" from __future__ import annotations import json from unittest.mock import AsyncMock, MagicMock import pytest from deeptutor.partners.bus.events import OutboundMessage from deeptutor.partners.bus.queue import MessageBus from deeptutor.partners.channels impor...
359
13,357
DeepTutor
tests/services/partners/test_wecom_channel.py
.py
"""Regression coverage for the WeCom SDK integration.""" from __future__ import annotations import asyncio import sys from types import ModuleType from typing import Any from unittest.mock import Mock from deeptutor.partners.channels import wecom class CapturingWSClient: """Minimal wecom-aibot-sdk 1.0.8-compat...
87
2,797
DeepTutor
tests/services/partners/conftest.py
.py
"""Fixtures for the partners service suite — isolate all paths under tmp_path.""" from __future__ import annotations from pathlib import Path import pytest @pytest.fixture def partners_root(tmp_path, monkeypatch) -> Path: """Redirect the admin workspace (and multi-user roots) under ``tmp_path``. Everythin...
31
1,139
DeepTutor
tests/knowledge/test_manager_list.py
.py
"""Tests for KnowledgeBaseManager.list_knowledge_bases() orphan pruning. When a KB entry remains in ``kb_config.json`` but its on-disk directory has been removed (failed init, manual ``rm -rf``, etc.), the entry must be pruned from the list — and from the persisted config — so the UI does not keep surfacing zombie KBs...
100
3,591
DeepTutor
tests/knowledge/test_linked_folder_sync.py
.py
"""Persistence of linked-folder sync state (``metadata.json``). ``update_folder_sync_state()`` used to mutate the loaded metadata dict and return without writing it back, so ``last_sync``/``synced_files`` silently vanished while the API layer logged success. These tests pin the write-back. The atomicity contract of th...
60
2,184
DeepTutor
tests/knowledge/test_lightrag_server_kb.py
.py
"""Manager handling of LightRAG Server KBs (``type: lightrag_server`` pointers). A LightRAG Server KB is a connection pointer to an external server: no on-disk folder under ``base_dir``, no local index, and deleting it must only drop our pointer (never touch the user's server). The stored API key must never leak into ...
107
4,197
DeepTutor
tests/knowledge/test_manager_embedding_flags.py
.py
from __future__ import annotations import json from pathlib import Path import pytest from deeptutor.knowledge.manager import KnowledgeBaseManager class _Signature: def __init__(self, sig_hash: str = "active-signature") -> None: self._hash = sig_hash def hash(self) -> str: return self._has...
180
5,660
DeepTutor
tests/knowledge/test_linked_kb_manager.py
.py
"""Manager handling of linked KBs (``type: linked`` engine-index pointers). A linked KB mounts a pre-built index in place: no on-disk folder under ``base_dir``, read-only, and — critically — deleting it must never touch the user's external files. Mirrors the Obsidian pointer guarantees but for an engine-backed index q...
106
4,166
DeepTutor
tests/knowledge/test_subagent_connection_kb.py
.py
"""Manager handling of connected-subagent KBs (``type: subagent`` pointers). A subagent connection records the backend (``agent_kind``) and its target — a ``cwd`` for a local CLI, or a ``partner_id`` for a partner. Like the other connected types it creates no folder and runs no index. The critical contract exercised h...
44
1,891
DeepTutor
tests/knowledge/test_kb_directory_layout.py
.py
from __future__ import annotations from pathlib import Path from deeptutor.knowledge.add_documents import DocumentAdder from deeptutor.knowledge.initializer import KnowledgeBaseInitializer def test_initializer_creates_raw_only_source_layout(tmp_path: Path) -> None: initializer = KnowledgeBaseInitializer(kb_name...
41
1,599
DeepTutor
tests/knowledge/test_obsidian_kb.py
.py
"""Manager handling of connected Obsidian KBs (``type: obsidian`` pointers). A connected vault is a pointer with no on-disk KB folder and no index, so the manager must (1) not prune it as an orphan, (2) not run provider/embedding normalization on it, and (3) surface its ``type`` / ``vault_path`` through ``get_metadata...
78
3,143