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
deeptutor_cli/_tool_result.py
.py
"""Tool-result truncation and on-demand expansion buffer for the CLI. Tool outputs in agent loops (RAG hits, web search dumps, file reads, code execution stdout) can run to hundreds of lines. Streaming the full body into the terminal drowns the reasoning around it and forces the user to scroll past noise on every turn...
167
5,799
DeepTutor
deeptutor_cli/plugin.py
.py
""" CLI Plugin Command ================== List and inspect registered plugins (tools, capabilities, playground). """ from __future__ import annotations from dataclasses import asdict from rich.console import Console from rich.table import Table import typer console = Console() def register(app: typer.Typer) -> N...
82
2,607
DeepTutor
deeptutor_cli/memory.py
.py
"""CLI memory commands for the three-layer memory subsystem (v2).""" from __future__ import annotations from rich.console import Console from rich.markdown import Markdown from rich.panel import Panel import typer from deeptutor.services.memory import ( L3_SLOTS, SURFACES, get_memory_store, paths, ) ...
100
3,674
DeepTutor
deeptutor_cli/init_wizard.py
.py
"""Interactive setup helpers used by ``deeptutor init``. Drives the multi-step wizard: provider menu, API-key capture (with env-var auto-detect), live model-list fetch from ``GET {base_url}/models`` with a curated fallback list, and an optional connectivity probe before save. Everything that touches I/O (HTTP, env, s...
1,049
34,902
DeepTutor
tests/test_packaging_metadata.py
.py
"""Tests for dependency metadata shared by the published packages.""" from __future__ import annotations from pathlib import Path import tomllib import pytest REPOSITORY_ROOT = Path(__file__).resolve().parents[1] @pytest.mark.parametrize( "metadata_path", [ REPOSITORY_ROOT / "pyproject.toml", ...
26
740
DeepTutor
tests/test_matrix_requirements.py
.py
"""Tests for Matrix dependency split.""" from pathlib import Path ROOT = Path(__file__).resolve().parents[1] def test_matrix_default_requirements_do_not_install_e2e() -> None: text = (ROOT / "requirements" / "matrix.txt").read_text(encoding="utf-8") assert "matrix-nio[e2e]" not in text assert "matrix-n...
20
576
DeepTutor
tests/conftest.py
.py
""" Root conftest — shared fixtures for the entire test suite. """ from __future__ import annotations from pathlib import Path from unittest.mock import MagicMock import pytest from deeptutor.core.capability_protocol import BaseCapability, CapabilityManifest from deeptutor.core.context import Attachment, UnifiedCon...
221
7,649
DeepTutor
tests/capabilities/test_obsidian_capability.py
.py
"""Tests for the Obsidian knowledge capability: vault ops, hooks, tools, exclusivity.""" from __future__ import annotations import json from pathlib import Path import pytest from deeptutor.agents._shared.tool_composition import ToolMountFlags, compose_enabled_tools from deeptutor.capabilities import any_exclusive_...
240
9,965
DeepTutor
tests/capabilities/test_rag_consistency.py
.py
"""Tests for RAG/KB consistency at the capability layer. After the refactor, RAG is no longer a user-selectable tool — its availability is derived from whether any knowledge bases are attached for the turn. These tests pin the contract that: * ``deep_solve`` now runs on the chat agent loop (solve loop capability), re...
170
6,407
DeepTutor
tests/capabilities/test_solve_capability.py
.py
"""Tests for the Deep Solve loop capability: capability hooks, owned tools, session.""" from __future__ import annotations import json import pytest from deeptutor.capabilities.solve import SOLVE_TOOL_NAMES, SolveLoopCapability from deeptutor.capabilities.solve.session import SolveSession, get_session from deeptuto...
129
4,540
DeepTutor
tests/capabilities/test_explore_context_capability.py
.py
"""Unit tests for the explore-context loop capability and its explorer.""" from __future__ import annotations from typing import Any import pytest from deeptutor.capabilities.explore_context import ExploreContextCapability from deeptutor.capabilities.explore_context import explorer as explorer_mod from deeptutor.ca...
316
11,622
DeepTutor
tests/capabilities/test_mastery_capability.py
.py
"""Tests for mastery loop hooks that bind persisted pending questions.""" from __future__ import annotations from pathlib import Path from deeptutor.capabilities.mastery.loop import MasteryLoopCapability from deeptutor.core.context import UnifiedContext from deeptutor.learning.models import LearningProgress, Pending...
83
2,666
DeepTutor
tests/capabilities/test_status_i18n_consistency.py
.py
"""Guards against StatusI18n status-message drift for the visualize capability. A capability that calls ``i18n.t("some_key", "default", ...)`` must have ``some_key`` defined in ``agents/<module>/prompts/{en,zh}/<capability>.yaml`` under the ``status:`` section. If it isn't, ``StatusI18n.t`` silently falls back to the ...
66
2,566
DeepTutor
tests/capabilities/test_subagent_capability.py
.py
"""Tests for the subagent capability: binding, activation, tool budget/streaming. The capability is the connected-agent twin of Obsidian — selecting a ``type: subagent`` KB runs the turn exclusively on ``consult_subagent``. These tests stub the KB metadata resolver and the backend, so nothing spawns a real CLI; they v...
281
11,540
DeepTutor
tests/tools/test_rag_tool.py
.py
"""Factory + tool-wrapper layer tests (llamaindex-only).""" from __future__ import annotations import pytest from deeptutor.services.rag.factory import ( DEFAULT_PROVIDER, get_pipeline, list_pipelines, normalize_provider_name, ) from deeptutor.tools.rag_tool import ( RAGService, get_available...
124
4,029
DeepTutor
tests/tools/test_kb_files_tool.py
.py
"""``kb_files`` — enumerate a knowledge base, the query ``rag`` cannot serve. ``rag`` returns passages, so "how many files are in here" and "is X in this KB" have no answer on that path. This tool reads the inventory instead, through the same access-checked seam the chat manifest uses, and it mounts under the same gat...
187
6,645
DeepTutor
tests/tools/test_mineru_models.py
.py
from __future__ import annotations from pathlib import Path import threading import time import pytest from deeptutor.services.parsing.engines.mineru import models as mineru_models from deeptutor.services.parsing.engines.mineru.models import ( ModelDownloadManager, model_env_overrides, resolve_models_dow...
176
5,969
DeepTutor
tests/tools/test_question_extractor.py
.py
from __future__ import annotations import importlib.util import json from pathlib import Path import sys import types def _load_question_extractor_module(): module_path = ( Path(__file__).resolve().parents[2] / "deeptutor" / "tools" / "question" / "question_extractor.py" ...
76
2,708
DeepTutor
tests/tools/test_list_notebook.py
.py
"""Unit tests for the ``list_notebook`` tool's pure rendering logic.""" from __future__ import annotations from deeptutor.tools.list_notebook import ( MAX_NOTEBOOKS_RENDERED, MAX_RECORDS_RENDERED, list_notebooks_or_records, ) class _FakeManager: """Minimal NotebookManager stand-in for unit tests."""...
148
5,083
DeepTutor
tests/tools/test_mineru.py
.py
from __future__ import annotations import io import json from pathlib import Path import zipfile import httpx as real_httpx import pytest from deeptutor.services.parsing.engines.mineru import backend as mineru_backend from deeptutor.services.parsing.engines.mineru import cloud as mineru_cloud from deeptutor.services...
441
14,813
DeepTutor
tests/tools/test_web_fetch.py
.py
"""Unit tests for the ``web_fetch`` tool's pure helpers.""" from __future__ import annotations import pytest from deeptutor.tools.web_fetch import ( DEFAULT_MAX_CHARS, FetchOutcome, _extract_readable, _is_disallowed_host, fetch_url_as_markdown, ) # -----------------------------------------------...
184
5,687
DeepTutor
tests/tools/test_ask_user.py
.py
"""Unit tests for ``ask_user`` payload building. Covers the v3 schema (option = ``{label, description}``, ``header``, ``multi_select``), the v2 plain-string-options shape, and the legacy single-question shorthand which auto-wraps into a one-element list. """ from __future__ import annotations from deeptutor.tools.as...
347
10,789
DeepTutor
tests/tools/test_write_note.py
.py
"""Unit tests for the ``write_note`` tool (append + edit modes).""" from __future__ import annotations from deeptutor.tools.write_note import ( ALL_TURNS_SENTINEL, DEFAULT_TURNS_TO_INCLUDE, MAX_NOTE_CHARS, MAX_TITLE_CHARS, write_note, ) class _FakeManager: """Notebook manager stand-in. Track...
319
10,141
DeepTutor
tests/tools/test_github_query.py
.py
"""Unit tests for the ``github_query`` tool's pure logic. We never spawn ``gh`` for real — every test injects its own ``command_runner`` so we can pin returncode / stdout / stderr. """ from __future__ import annotations import asyncio from typing import Any import pytest from deeptutor.tools.github_query import ( ...
188
5,371
DeepTutor
tests/tools/test_web_search.py
.py
"""Tests for web search tool types, provider registry, and validation.""" from __future__ import annotations import pytest from deeptutor.services.search import _assert_provider_supported from deeptutor.services.search.providers import ( _DEPRECATED_UNSUPPORTED, get_provider, get_providers_info, list...
140
4,921
DeepTutor
tests/tools/test_file_tools.py
.py
from __future__ import annotations import pytest from deeptutor.tools.file_tools import EditFileTool, ListDirTool, ReadFileTool, WriteFileTool def _ctx(tmp_path): workspace = tmp_path / "workspace" workspace.mkdir() return {"_workspace_dir": str(workspace), "_allowed_dir": str(workspace)}, workspace @...
61
2,083
DeepTutor
tests/services/test_codebuddy_credentials.py
.py
"""Tests for reading the shared CodeBuddy login state.""" from __future__ import annotations import base64 import gzip import json from pathlib import Path import time import pytest from deeptutor.services import codebuddy_credentials from deeptutor.services.codebuddy_credentials import ( INTERNAL_ENDPOINT, ...
162
5,959
DeepTutor
tests/services/test_subagent_backends.py
.py
"""Tests for the subagent driver layer: command building, event parsing, the streaming-subprocess primitive, and settings. Event parsing is exercised by feeding crafted CLI events straight into each backend's handler — no real ``claude`` / ``codex`` process is spawned, so the suite is fast and deterministic. The one l...
1,360
51,085
DeepTutor
tests/services/test_codebuddy_auth.py
.py
from __future__ import annotations import asyncio from types import SimpleNamespace import pytest from deeptutor.services import codebuddy_auth from deeptutor.services.codebuddy_auth import CodeBuddyAuthService class FakeFlow: def __init__(self, auth_url: str, result=None) -> None: self.auth_url = auth...
176
5,390
DeepTutor
tests/services/test_path_service_runtime_home.py
.py
from __future__ import annotations from pathlib import Path from deeptutor.services.path_service import PathService def test_path_service_defaults_to_deeptutor_home(monkeypatch, tmp_path: Path) -> None: monkeypatch.setenv("DEEPTUTOR_HOME", str(tmp_path)) PathService.reset_instance() service = PathServi...
19
587
DeepTutor
tests/services/test_model_catalog.py
.py
from concurrent.futures import ThreadPoolExecutor import json from pathlib import Path from deeptutor.services.config.model_catalog import ModelCatalogService def test_load_creates_empty_catalog_without_dotenv_hydration(tmp_path: Path): env_path = tmp_path / ".env" env_path.write_text( "LLM_MODEL=leg...
248
8,474
DeepTutor
tests/services/test_notebook_service.py
.py
"""Notebook service regression tests.""" from __future__ import annotations import json from deeptutor.services.notebook.service import NotebookManager, RecordType def test_add_record_accepts_enum_record_type(tmp_path) -> None: manager = NotebookManager(base_dir=str(tmp_path)) notebook = manager.create_not...
70
2,299
DeepTutor
tests/services/test_parse_language.py
.py
"""Language codes must survive parsing. ``parse_language`` used to be a binary zh/en classifier whose final statement was ``return "zh"``, so a Japanese book came back with Chinese quizzes — the prose path normalized the code correctly while quiz, Deep Research and Mastery Path all ran through this one (issue #712). "...
62
2,328
DeepTutor
tests/services/test_voice.py
.py
"""Tests for the voice (TTS/STT) service layer. Covers Markdown cleaning, the OpenAI-compatible adapters' wire shape, the OpenRouter base64-JSON STT branch, Azure auth headers, and catalog-driven config resolution. """ from __future__ import annotations import base64 import json from typing import Any import httpx ...
354
13,825
DeepTutor
tests/services/test_provider_registry.py
.py
from deeptutor.services.provider_registry import find_by_name, find_gateway def test_nvidia_nim_gateway_detection_by_key_and_base() -> None: spec = find_by_name("nvidia_nim") assert spec is not None assert spec.supports_stream_options is False assert find_gateway(api_key="nvapi-test-key") == spec ...
93
3,405
DeepTutor
tests/services/test_prompt_manager.py
.py
"""Prompt manager path resolution tests.""" from __future__ import annotations from deeptutor.services.prompt import get_prompt_manager def test_prompt_manager_loads_prompts_from_deeptutor_tree() -> None: manager = get_prompt_manager() manager.clear_cache() prompts = manager.load_prompts( modul...
19
441
DeepTutor
tests/services/test_runtime_storage_guard.py
.py
from __future__ import annotations from pathlib import Path from deeptutor.agents.research.utils.citation_manager import CitationManager from deeptutor.services.config.loader import load_config_with_main from deeptutor.services.path_service import PathService def test_runtime_config_paths_are_confined_to_data_user(...
41
1,640
DeepTutor
tests/services/test_config_loader.py
.py
from __future__ import annotations from pathlib import Path import pytest from deeptutor.services.config.loader import ( PROJECT_ROOT, load_config_with_main, resolve_config_path, ) def test_resolve_config_path_returns_existing_config(tmp_path: Path) -> None: settings_dir = tmp_path / "data" / "user...
57
1,960
DeepTutor
tests/services/test_path_service.py
.py
from __future__ import annotations from pathlib import Path from deeptutor.services.path_service import PathService def test_public_output_filter_allows_only_whitelisted_artifacts(tmp_path: Path) -> None: service = PathService.get_instance() original_root = service._project_root original_user_dir = serv...
201
7,199
DeepTutor
tests/services/test_file_io.py
.py
from __future__ import annotations import json from pathlib import Path import pytest from deeptutor.services import file_io from deeptutor.services.file_io import atomic_write_json, atomic_write_text def test_atomic_write_json_creates_parent_and_replaces_content(tmp_path: Path) -> None: path = tmp_path / "nes...
62
1,956
DeepTutor
tests/services/test_media_gen.py
.py
"""Tests for the image/video generation service layer. Covers the shared HTTP helpers, the OpenAI-compatible imagegen adapter (both ``b64_json`` and ``url`` response shapes), the async-task videogen adapter (submit → poll → download, plus failure + payload shaping), catalog-driven config resolution, and the public fac...
439
17,994
DeepTutor
tests/services/skill/test_skill_service_v2.py
.py
"""SkillService v2: builtin/user layers, manifest, requires gating, read_skill, always.""" from __future__ import annotations from pathlib import Path import pytest from deeptutor.services.skill.service import ( InvalidSkillPathError, SkillNotFoundError, SkillReadOnlyError, SkillService, render_...
139
5,341
DeepTutor
tests/services/skill/test_skill_login.py
.py
"""Tests for the browser-OAuth loopback login helper (skill login).""" from __future__ import annotations import threading import time import urllib.error import urllib.parse import urllib.request from deeptutor_cli.skill_login import ( hub_origin_from_base, oauth_start_url, run_login, ) def test_hub_o...
94
2,962
DeepTutor
tests/services/skill/test_skill_publish_flow.py
.py
"""Tests for the interactive publish/update plumbing: preflight, taxonomy, the overrides merge in publish_to_hub, and the two-level domain picker.""" from __future__ import annotations from pathlib import Path import pytest from deeptutor.services.skill import taxonomy from deeptutor.services.skill.hub import ( ...
187
6,770
DeepTutor
tests/services/skill/test_skill_hub.py
.py
"""Skill hub import: install_tree policy, ref parsing, providers, orchestration.""" from __future__ import annotations import io import os from pathlib import Path import shutil import tempfile import zipfile import httpx import pytest from deeptutor.services.skill.hub import ( ClawHubProvider, CommandProvi...
481
18,952
DeepTutor
tests/services/sandbox/test_sandbox.py
.py
"""Sandbox: backend selection, restricted subprocess exec, quota, level gating.""" from __future__ import annotations import asyncio import pytest from deeptutor.services.sandbox.backends import BwrapBackend, RestrictedSubprocessBackend from deeptutor.services.sandbox.config import SandboxSettings, build_backend fr...
186
6,696
DeepTutor
tests/services/sandbox/test_argv_exec.py
.py
"""Running a command as an argument vector rather than as a shell string. A CLI app's arguments come from the model, so the program is fixed and the arguments are not — the one exec path where a shell buys nothing and costs everything. Two properties are pinned here: * ``argv`` and ``command`` always describe the sam...
191
6,912
DeepTutor
tests/services/llm/test_codex_disable_ssl_verify.py
.py
"""DISABLE_SSL_VERIFY coverage for the OpenAI Codex Responses provider. The codex provider was previously hardcoded to ``verify=True`` on the first attempt, with an auto-retry on ``CERTIFICATE_VERIFY_FAILED``. The flag now short-circuits the first attempt while preserving the retry-on-cert-failure fallback. """ from ...
123
4,099
DeepTutor
tests/services/llm/test_factory_provider_exec.py
.py
"""Tests for provider-backed execution in llm.factory.""" from __future__ import annotations from typing import Any import pytest from deeptutor.services.llm.config import LLMConfig from deeptutor.services.llm.factory import complete, stream from deeptutor.services.llm.provider_core.base import LLMResponse class ...
287
9,154
DeepTutor
tests/services/llm/test_client.py
.py
"""Tests for the LLM client wrapper.""" from __future__ import annotations from _pytest.monkeypatch import MonkeyPatch import pytest from deeptutor.services.llm.client import LLMClient from deeptutor.services.llm.config import LLMConfig @pytest.mark.asyncio async def test_client_complete_uses_factory(monkeypatch: ...
176
5,587
DeepTutor
tests/services/llm/test_codebuddy_http_provider.py
.py
"""Tests for the SDK-free CodeBuddy HTTP provider.""" from __future__ import annotations import json from pathlib import Path import time from typing import Any import pytest from deeptutor.services.codebuddy_credentials import ( INTERNAL_ENDPOINT, CodeBuddyAuthUnavailable, ) from deeptutor.services.llm.pro...
162
5,360
DeepTutor
tests/services/llm/test_codebuddy_provider.py
.py
from __future__ import annotations import asyncio import os import shutil import sys from types import SimpleNamespace import pytest from deeptutor.services.llm.config import LLMConfig from deeptutor.services.llm.provider_core import CodeBuddyProvider from deeptutor.services.llm.provider_core.codebuddy_provider impo...
467
14,162
DeepTutor
tests/services/llm/test_registry.py
.py
"""Tests for provider registry utilities.""" from deeptutor.services.llm import registry def test_registry_register_and_lookup() -> None: """Registering a provider should make it discoverable.""" class _Provider: pass name = "registry_test" registry._provider_registry.pop(name, None) tr...
22
625
DeepTutor
tests/services/llm/test_multimodal.py
.py
"""Tests for the two-stage multimodal pipeline. Stage 1 (:func:`prepare_multimodal_messages`) injects image attachments for *every* provider/model — there is no ``supports_vision`` pre-flight gate. It only resolves URL→base64 where the provider's *format* requires it and drops url-only images it cannot encode (``url_i...
197
8,508
DeepTutor
tests/services/llm/test_cloud_provider.py
.py
"""Tests for cloud provider helpers.""" from __future__ import annotations import importlib from types import TracebackType from _pytest.monkeypatch import MonkeyPatch import pytest from deeptutor.services.llm.exceptions import LLMAPIError cloud_provider = importlib.import_module("deeptutor.services.llm.cloud_prov...
195
5,372
DeepTutor
tests/services/llm/test_provider_core_image_fallback.py
.py
"""Stage-2 image fallback gating in ``provider_core.base.LLMProvider``. The factory passes ``allow_image_fallback = not supports_vision(...)``. When True (model not in the known-vision allowlist) a non-transient failure that carried images is retried text-only; when False (known vision-capable) the images are kept and...
81
2,756
DeepTutor
tests/services/llm/test_capabilities.py
.py
"""Tests for LLM capability helpers.""" from deeptutor.services.llm.capabilities import ( get_capability, get_effective_temperature, has_thinking_tags, supports_response_format, supports_tools, supports_vision, ) def test_model_override_capability() -> None: """Model overrides should take...
144
6,413
DeepTutor
tests/services/llm/test_public_exports.py
.py
from deeptutor.services import llm def test_llm_module_exports_cache_helpers(): assert callable(llm.clear_llm_config_cache) assert callable(llm.reload_config)
7
169
DeepTutor
tests/services/llm/test_routing_provider.py
.py
"""Tests for the routing provider wrapper.""" import asyncio from collections.abc import AsyncGenerator from deeptutor.services.llm.config import LLMConfig from deeptutor.services.llm.providers.routing import RoutingProvider async def _collect_stream(provider: RoutingProvider) -> list[object]: chunks: list[obje...
71
2,306
DeepTutor
tests/services/llm/test_openai_http_client.py
.py
"""Tests for OpenAI SDK HTTP client options shared across providers.""" from __future__ import annotations from types import SimpleNamespace from typing import Any import pytest from deeptutor.services.llm import openai_http_client from deeptutor.services.llm.exceptions import LLMConfigError @pytest.fixture(autou...
187
6,056
DeepTutor
tests/services/llm/test_reasoning_params.py
.py
"""Tests for the centralized reasoning-effort registry.""" from __future__ import annotations import pytest from deeptutor.services.llm.reasoning_params import ( build_openai_compatible_reasoning_kwargs, default_reasoning_effort_for, ) class TestDefaultReasoningEffortFor: """Single source of truth for ...
96
3,591
DeepTutor
tests/services/llm/test_openai_responses_converters.py
.py
"""Tests for the Responses API converter helpers.""" from __future__ import annotations from deeptutor.services.llm.provider_core.openai_responses import ( adapt_chat_kwargs_to_responses, ) class TestAdaptChatKwargsToResponses: def test_passes_through_unrelated_kwargs(self) -> None: result = adapt_c...
55
2,656
DeepTutor
tests/services/llm/test_base_provider.py
.py
"""Tests for BaseLLMProvider retry behavior.""" import asyncio from deeptutor.services.llm.config import LLMConfig from deeptutor.services.llm.exceptions import LLMRateLimitError from deeptutor.services.llm.providers.base_provider import BaseLLMProvider class DummyProvider(BaseLLMProvider): """Minimal provider ...
39
1,223
DeepTutor
tests/services/llm/test_error_mapping.py
.py
"""Tests for LLM error mapping helpers.""" from deeptutor.services.llm.error_mapping import map_error from deeptutor.services.llm.exceptions import ( LLMAPIError, LLMAuthenticationError, LLMRateLimitError, ProviderContextWindowError, ) class DummyError(Exception): """Custom error used for mapping...
43
1,549
DeepTutor
tests/services/llm/test_openai_responses_parsing.py
.py
"""Regression tests for OpenAI Responses API stream parsing.""" from __future__ import annotations import json from types import SimpleNamespace import pytest from deeptutor.services.llm.provider_core.openai_responses.parsing import ( consume_sdk_stream, consume_sse, ) class _SSEFixture: def __init__(...
146
4,462
DeepTutor
tests/services/llm/test_telemetry.py
.py
"""Tests for telemetry decorator behavior.""" from _pytest.monkeypatch import MonkeyPatch import pytest from deeptutor.services.llm import telemetry class _FakeLogger: def __init__(self) -> None: self.messages: list[str] = [] def debug(self, message: str, *args: object, **_kwargs: object) -> None: ...
50
1,468
DeepTutor
tests/services/llm/test_request_compat.py
.py
from __future__ import annotations from deeptutor.services.llm.request_compat import ( error_text, is_image_input_unsupported, is_stream_options_unsupported, is_tool_schema_unsupported, ) class _Response: text = "Unsupported parameter: stream_options" class _ProviderError(Exception): respon...
37
1,137
DeepTutor
tests/services/llm/test_traffic_control.py
.py
"""Tests for traffic control behavior.""" import pytest from deeptutor.services.llm.traffic_control import TrafficController @pytest.mark.asyncio async def test_traffic_control_context() -> None: """Traffic control context manager should acquire and release slots.""" controller = TrafficController( ...
21
541
DeepTutor
tests/services/llm/test_openai_compat_reasoning_content.py
.py
"""Reasoning-content handling for OpenAI-compatible providers.""" from __future__ import annotations from types import SimpleNamespace import pytest from deeptutor.services.llm.provider_core.openai_compat_provider import ( OpenAICompatProvider as ServicesOpenAICompatProvider, ) from deeptutor.services.provider_...
150
4,401
DeepTutor
tests/services/llm/test_openai_codex_oauth_provider.py
.py
from __future__ import annotations from contextlib import asynccontextmanager from typing import Any, AsyncIterator import pytest from deeptutor.services.codex_auth.constants import CODEX_RESPONSES_URL from deeptutor.services.codex_auth.contracts import CodexAuthError, CodexToken from deeptutor.services.llm.provider...
234
7,645
DeepTutor
tests/services/llm/test_anthropic_provider_fixes.py
.py
"""Regression tests for Anthropic provider support of newer Claude models. Covers three fixes: 1. A ``base_url`` ending in ``/v1`` must not be doubled by the SDK. 2. ``temperature`` is omitted for effort-based models that reject it. 3. ``cache_control`` breakpoints never exceed the Anthropic limit of 4. """ from __fu...
176
6,455
DeepTutor
tests/services/llm/test_llm_live.py
.py
""" Live LLM connectivity test. Run directly to verify your data/user/settings model config is working: python tests/services/llm/test_llm_live.py python tests/services/llm/test_llm_live.py --stream # also test streaming python tests/services/llm/test_llm_live.py --model gpt-4o --base-url https://api.o...
167
5,449
DeepTutor
tests/services/llm/test_provider_pool.py
.py
from __future__ import annotations from typing import Any import pytest import pytest_asyncio from deeptutor.services.llm import provider_factory from deeptutor.services.llm.config import LLMConfig class _FakeProvider: def __init__(self) -> None: self.generation: Any = None self.closed = 0 ...
102
2,954
DeepTutor
tests/services/llm/test_utils.py
.py
"""Tests for LLM utility helpers.""" import pytest from deeptutor.services.llm.utils import ( build_auth_headers, build_chat_url, build_completion_url, clean_thinking_tags, collect_model_names, extract_response_content, is_local_llm_server, sanitize_url, ) def test_sanitize_url_norma...
117
4,186
DeepTutor
tests/services/llm/test_config_module.py
.py
"""Tests for LLM configuration helpers.""" from __future__ import annotations import os import pytest from deeptutor.services.config.provider_runtime import ResolvedLLMConfig from deeptutor.services.llm import config as config_module from deeptutor.services.llm.config import LLMConfig from deeptutor.services.llm.ex...
174
5,805
DeepTutor
tests/services/rag/test_file_routing.py
.py
"""Tests for FileTypeRouter classification and helper methods.""" from __future__ import annotations import asyncio from pathlib import Path import pytest from deeptutor.services.rag.file_routing import ( DocumentType, FileTypeRouter, ) class TestExtensionClassification: @pytest.mark.parametrize( ...
154
5,770
DeepTutor
tests/services/rag/test_rag_pipelines.py
.py
"""RAGService end-to-end behavior tests (with a fake pipeline).""" from __future__ import annotations import asyncio import importlib import logging from typing import Any, Dict import pytest import deeptutor.services.rag.service as rag_service_module from deeptutor.services.rag.service import RAGService from deept...
346
13,020
DeepTutor
tests/services/rag/test_llamaindex_faiss_vector_store.py
.py
"""Tests for the FAISS-backed vector store seam (issue #552). These cover the behaviours plan B relies on: new indexes persist as FAISS, legacy SimpleVectorStore indexes are rebuilt in-memory without re-embedding, mixed-dimension/faiss-less installs fall back to SimpleVectorStore, and the retrieval path loads + valida...
326
13,348
DeepTutor
tests/services/rag/test_llamaindex_embedding_roles.py
.py
"""Tests for query/document roles in the LlamaIndex embedding bridge.""" from __future__ import annotations from types import SimpleNamespace def test_custom_embedding_passes_query_and_document_roles(monkeypatch) -> None: from deeptutor.services.rag.pipelines.llamaindex import ( embedding_adapter as emb...
50
1,627
DeepTutor
tests/services/rag/test_llamaindex_document_loader.py
.py
"""Tests for LlamaIndex document loading. Parser-backed files (PDF / Office / e-book) are routed through the shared parse layer, so these tests exercise the *routing* — that the loader turns a ``ParsedDocument`` into text ``Document``s and feeds engine-extracted images into the multimodal ``ImageNode`` path. Real per-...
295
11,098
DeepTutor
tests/services/rag/test_llamaindex_embedding_failures.py
.py
from __future__ import annotations import asyncio import json from types import SimpleNamespace import pytest def test_custom_embedding_rejects_null_coordinates(monkeypatch: pytest.MonkeyPatch) -> None: from deeptutor.services.rag.pipelines.llamaindex import ( embedding_adapter as embedding_module, ...
251
9,136
DeepTutor
tests/services/rag/test_llamaindex_ingestion.py
.py
from __future__ import annotations from llama_index.core import Document from llama_index.core.schema import TextNode def test_documents_do_not_bypass_chunking_pipeline(monkeypatch) -> None: from deeptutor.services.rag.pipelines.llamaindex import ingestion captured: dict[str, object] = {} class FakePip...
32
1,159
DeepTutor
tests/services/rag/test_llamaindex_index_cache_bounds.py
.py
from pathlib import Path import pytest from deeptutor.services.rag.pipelines.llamaindex import storage @pytest.fixture(autouse=True) def _clear_cache(): storage.clear_index_cache() yield storage.clear_index_cache() def test_loaded_index_cache_uses_small_lru(monkeypatch, tmp_path: Path) -> None: mo...
41
1,276
DeepTutor
tests/services/rag/test_linked_kb.py
.py
"""Probing and resolving externally-linked knowledge bases. A *linked* KB points at a self-contained engine index the user built elsewhere. These tests cover the three load-bearing pieces: the storage-dir seam (:func:`resolve_kb_dir`), the connect-time probe (ready index? right engine? compatible embedding?), and the ...
163
5,727
DeepTutor
tests/services/rag/test_pageindex_pipeline.py
.py
"""Unit tests for the PageIndex cloud RAG pipeline + provider routing. The pipeline talks to PageIndex's REST API through an injectable client, so we exercise the orchestration (file filtering, manifest, outline search contract, delete) against a fake client without any network calls. Deep retrieval is agentic via the...
213
7,465
DeepTutor
tests/services/rag/test_index_probe.py
.py
from __future__ import annotations import json from pathlib import Path from deeptutor.services.rag.index_probe import ( has_ready_provider_index, inspect_kb_versions, inspect_provider_index, inspect_provider_version, provider_failure_summary, ) from deeptutor.services.rag.pipelines.graphrag impor...
154
4,932
DeepTutor
tests/services/rag/test_llamaindex_storage_layout.py
.py
from __future__ import annotations import json from pathlib import Path import pytest from deeptutor.services.rag.index_versioning import EmbeddingSignature def _signature() -> EmbeddingSignature: return EmbeddingSignature( binding="openai", model="embed-a", dimension=1024, base...
217
7,188
DeepTutor
tests/services/rag/test_ima_pipeline.py
.py
"""Unit tests for the Tencent IMA (retrieval-only) RAG pipeline. The engine is a thin HTTPS client over IMA's knowledge-base OpenAPI. We exercise: * the client wire shapes (POST path, auth headers, ``{code,msg,data}`` envelope, cursor pagination, error-code mapping) against an injected ``httpx.MockTransport`` — n...
433
15,674
DeepTutor
tests/services/rag/test_pipeline_integration.py
.py
#!/usr/bin/env python """ RAG Pipeline Integration Tests ============================== Complete integration tests for RAG pipelines. Tests the full workflow: initialize -> search -> delete Usage: # Test specific pipeline python tests/services/rag/test_pipeline_integration.py --pipeline llamaindex # Test...
446
13,905
DeepTutor
tests/services/rag/test_lightrag_server_pipeline.py
.py
"""Unit tests for the LightRAG Server (retrieval-only) RAG pipeline. The engine is a thin HTTP client over an external LightRAG server. We exercise: * the client wire shapes (``/query`` only_need_context, references→sources) against an injected ``httpx.MockTransport`` — no network, * the connect-time probe verdict ...
261
9,251
DeepTutor
tests/services/rag/test_index_versioning.py
.py
from __future__ import annotations import json from pathlib import Path from deeptutor.services.rag.index_versioning import ( EmbeddingSignature, find_matching_version, list_kb_versions, resolve_storage_dir_for_read, resolve_storage_dir_for_rebuild, resolve_storage_dir_for_write, write_ver...
133
4,593
DeepTutor
tests/services/rag/test_graphrag_pipeline.py
.py
"""Unit tests for the GraphRAG local RAG pipeline + provider routing. GraphRAG itself is an optional dependency that is NOT installed in CI, so these tests exercise everything that does not require the package (factory routing, config bridge, ingestion, storage, lifecycle gating) directly, and stub the thin ``engine``...
495
17,520
DeepTutor
tests/services/rag/test_lightrag_pipeline.py
.py
"""Unit tests for the LightRAG RAG pipeline + provider routing. RAG-Anything / LightRAG is an optional dependency that is NOT installed in CI, so these tests exercise everything that does not require the package (factory routing, config bridge, storage, lifecycle gating, parse-layer consumption) directly, and stub the...
785
28,380
DeepTutor
tests/services/rag/conftest.py
.py
"""Local conftest for RAG integration tests. The ``--pipeline`` option must be registered from a conftest (or a real plugin), not from a test module — otherwise pytest raises ``ValueError: pytest_addoption is only supported from a plugin or conftest``. """ from __future__ import annotations def pytest_addoption(par...
19
568
DeepTutor
tests/services/search/test_search_providers.py
.py
"""Provider-level tests: the resolved search config must reach the HTTP call. `web_search` hands every provider the same `max_results` / `proxy` knobs from the active search profile. A provider that names its parameter differently silently drops them, which is how Serper used to ignore both (it takes `num`, and never ...
357
13,140
DeepTutor
tests/services/search/test_web_search_runtime.py
.py
"""Tests for TutorBot-style web_search runtime behavior.""" from __future__ import annotations import pytest from deeptutor.services.config.provider_runtime import ResolvedSearchConfig from deeptutor.services.search import web_search from deeptutor.services.search.types import WebSearchResponse class _FakeProvider...
207
6,632
DeepTutor
tests/services/persona/test_persona_service.py
.py
"""PersonaService: CRUD, single-persona context rendering, legacy migration.""" from __future__ import annotations from pathlib import Path import pytest from deeptutor.services.persona.service import ( InvalidPersonaNameError, PersonaExistsError, PersonaNotFoundError, PersonaService, ) @pytest.fi...
134
4,959
DeepTutor
tests/services/config/test_llamaindex_settings.py
.py
"""LlamaIndex engine knobs stored in RuntimeSettingsService.""" from __future__ import annotations from pathlib import Path from deeptutor.services.config.runtime_settings import RuntimeSettingsService def test_llamaindex_defaults_when_absent(tmp_path: Path) -> None: svc = RuntimeSettingsService(tmp_path, proc...
76
2,730
DeepTutor
tests/services/config/test_launch_settings.py
.py
from __future__ import annotations import json from pathlib import Path from deeptutor.services.config.launch_settings import load_launch_settings def _settings_dir(root: Path) -> Path: path = root / "data" / "user" / "settings" path.mkdir(parents=True, exist_ok=True) return path def test_launch_setti...
77
2,407
DeepTutor
tests/services/config/test_knowledge_base_config.py
.py
"""Tests for KnowledgeBaseConfigService provider config + legacy migration.""" from __future__ import annotations import json from pathlib import Path import pytest from deeptutor.services.config.knowledge_base_config import ( KnowledgeBaseConfigService, ) def _write_kb_config(path: Path, payload: dict) -> No...
231
9,628