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 |
|---|---|---|---|---|---|
deepagents | libs/code/tests/unit_tests/test_version.py | .py | """Tests for version-related functionality."""
from __future__ import annotations
import asyncio
import subprocess
import sys
import tomllib
from importlib.metadata import version as pkg_version
from pathlib import Path
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, Mock, patch
import pytest
... | 2,035 | 77,913 |
deepagents | libs/code/tests/unit_tests/test_subagents.py | .py | """Unit tests for subagent loading functionality."""
import logging
from pathlib import Path
import pytest
from deepagents_code.subagents import (
_load_subagents_from_dir,
_parse_subagent_file,
list_subagents,
)
def make_subagent_content(
name: str,
description: str,
model: str | None = No... | 732 | 24,963 |
deepagents | libs/code/tests/unit_tests/test_goal_state_persistence.py | .py | """Tests for persisted goal-state notice reconciliation."""
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from deepagents_code.app import DeepAgentsApp
from deepagents_code.goal_state_noti... | 291 | 10,109 |
deepagents | libs/code/tests/unit_tests/test_update_check.py | .py | """Tests for the background update check module."""
from __future__ import annotations
import asyncio
import json
import logging
import os
import shlex
import shutil
import signal
import stat
import subprocess
import sys
import tempfile
import threading
import time
import tomllib
from collections.abc import Iterator,... | 6,106 | 246,086 |
deepagents | libs/code/tests/unit_tests/test_reasoning_effort.py | .py | """Tests for `/effort` reasoning effort handling.
Support data comes from LangChain model profiles, so most tests mock
`get_model_profiles()` instead of relying on installed provider packages.
"""
import logging
from collections.abc import Coroutine, Iterator
from contextlib import AbstractContextManager
from pathlib... | 1,413 | 48,465 |
deepagents | libs/code/tests/unit_tests/test__tool_stream.py | .py | """Tests for the shared streaming tool-call buffer and hook-payload builders.
`_tool_stream` is the single source of truth for reassembling streamed tool-call
arguments and building `tool.use` / `tool.result` / `tool.error` payloads across
both execution surfaces, so its contract is exercised directly here (the two
su... | 504 | 22,185 |
deepagents | libs/code/tests/unit_tests/test_terminal_escape.py | .py | """Tests for `deepagents_code.terminal_escape`."""
from __future__ import annotations
import io
import logging
import pathlib
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from types import TracebackType
from deepagents_code import terminal_escape
from deepagents_code.terminal_escape import ... | 387 | 16,016 |
deepagents | libs/code/tests/unit_tests/test_configurable_model.py | .py | """Tests for ConfigurableModelMiddleware."""
import asyncio
import logging
from collections.abc import Callable
from types import SimpleNamespace
from typing import Any, cast
from unittest.mock import MagicMock, patch
import pytest
from langchain.agents.middleware.types import (
ExtendedModelResponse,
ModelRe... | 1,546 | 57,747 |
deepagents | libs/code/tests/unit_tests/test_args.py | .py | """Tests for CLI argument parsing."""
import io
import re
import sys
from unittest.mock import AsyncMock, patch
import pytest
from rich.console import Console
from deepagents_code.main import parse_args
from deepagents_code.ui import show_help, show_threads_list_help
class TestInitialPromptArg:
"""Tests for -m... | 922 | 33,150 |
deepagents | libs/code/tests/unit_tests/test_goal_criteria_client.py | .py | """Tests for the TUI boundary of server-side goal criteria generation."""
from __future__ import annotations
import asyncio
from types import SimpleNamespace
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from deepagents_code.app import DeepAgentsApp
from deepag... | 474 | 15,061 |
deepagents | libs/code/tests/unit_tests/test_tool_catalog.py | .py | """Tests for tool enumeration behind `dcode tools list`."""
from __future__ import annotations
import asyncio
from types import SimpleNamespace
from unittest.mock import AsyncMock, PropertyMock, patch
import pytest
from deepagents_code.config import Settings
from deepagents_code.mcp_tools import MCPServerInfo, MCPT... | 706 | 26,538 |
deepagents | libs/code/tests/unit_tests/test_iterm_cursor_guide.py | .py | """Tests for the iTerm2 cursor guide workaround."""
from __future__ import annotations
import io
import os
from typing import TYPE_CHECKING
from unittest.mock import MagicMock, patch
from textual.app import App
from deepagents_code import iterm_cursor_guide
from deepagents_code.app import DeepAgentsApp
from deepage... | 257 | 9,856 |
deepagents | libs/code/tests/unit_tests/test_auth_web_search_restart.py | .py | """Tests for offering a server restart when a Tavily key is saved via `/auth`.
`web_search` is bound only when Tavily is configured at server spawn time
(see `server_graph._build_tools`), so a key added to an already-running server
takes effect only after a respawn. Saving a Tavily key in the `/auth` manager
should fl... | 610 | 24,435 |
deepagents | libs/code/tests/unit_tests/test_unicode_security.py | .py | """Unit tests for Unicode security helpers."""
import pytest
from deepagents_code.unicode_security import (
CONFUSABLES,
UnicodeIssue,
UrlSafetyResult,
check_url_safety,
detect_dangerous_unicode,
format_warning_detail,
iter_string_values,
looks_like_url_key,
render_with_unicode_mar... | 316 | 11,180 |
deepagents | libs/code/tests/unit_tests/test_cost_tracking.py | .py | """Tests for cost estimation and graph-side cumulative cost persistence."""
from __future__ import annotations
import asyncio
import builtins
import inspect
import json
import logging
import subprocess
import sys
import threading
import warnings
from concurrent.futures import ThreadPoolExecutor
from types import Simp... | 3,829 | 148,431 |
deepagents | libs/code/tests/unit_tests/test_sessions.py | .py | """Tests for session/thread management."""
import asyncio
import gc
import json
import sqlite3
import threading
import uuid
import warnings
from datetime import UTC, datetime, timedelta
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, cast
from unittest.mock import AsyncMock, MagicMock, patch
... | 3,311 | 131,885 |
deepagents | libs/code/tests/unit_tests/test_server_config.py | .py | """Tests for _server_config helpers and ServerConfig invariants."""
from __future__ import annotations
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from deepagents_code._env_vars import SERVER_ENV_PREFIX
from deepagents_code._server_config import (
ServerConfig,
_interpre... | 547 | 21,676 |
deepagents | libs/code/tests/unit_tests/test_skill_invocation.py | .py | """Unit tests for /skill:<name> command parsing and skill content loading."""
from __future__ import annotations
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from deepagents_code.command_registry import (
_STATIC_SKILL_ALIASES,
CommandEntry,
build_skill_co... | 1,051 | 42,300 |
deepagents | libs/code/tests/unit_tests/test_rubric_cli.py | .py | """Unit tests for rubric (`RubricMiddleware`) CLI wiring."""
from __future__ import annotations
import io
import os
import subprocess
import sys
import textwrap
from typing import TYPE_CHECKING
from unittest.mock import patch
import pytest
from rich.console import Console
if TYPE_CHECKING:
from pathlib import P... | 353 | 13,549 |
deepagents | libs/code/tests/unit_tests/test_goal_state_notice.py | .py | """Unit tests for goal-state notices and continuation messages."""
from langchain_core.messages import AIMessage, HumanMessage
from deepagents_code.goal_state_notice import (
GOAL_CONTROL_MESSAGE_SOURCE,
GOAL_MESSAGE_SCHEMA_VERSION,
GOAL_STATE_MESSAGE_SOURCE,
build_goal_continuation,
build_goal_st... | 313 | 11,138 |
deepagents | libs/code/tests/unit_tests/test_agent_friendly.py | .py | """Tests for agent-friendly CLI improvements.
Covers: --dry-run, idempotency, --stdin, error messages, agents subcommand,
update subcommand, and help screen examples.
"""
import asyncio
import io
import json
import re
import sys
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import py... | 622 | 22,399 |
deepagents | libs/code/tests/unit_tests/test_invocation.py | .py | """Unit tests for `deepagents_code._invocation`."""
from __future__ import annotations
import logging
import sys
from typing import TYPE_CHECKING
import pytest
from deepagents_code._env_vars import DEBUG, INVOKED_AS
from deepagents_code._invocation import (
DEFAULT_INVOKED_NAME,
STANDARD_INVOKED_NAMES,
... | 271 | 9,810 |
deepagents | libs/code/tests/unit_tests/test_clipboard.py | .py | """Unit tests for `deepagents_code.clipboard`.
Covers the clipboard-backend fallback chain (`copy_text_to_clipboard`),
selection-driven copy with notification UX (`copy_selection_to_clipboard`),
and the OSC 52 escape envelope (`_copy_osc52`).
"""
from __future__ import annotations
import base64
import io
import logg... | 601 | 21,985 |
deepagents | libs/code/tests/unit_tests/test_tracing_replicas.py | .py | """Tests for LangSmith dual-write replica configuration in `config`."""
from __future__ import annotations
import logging
from deepagents_code import config
from deepagents_code._env_vars import LANGSMITH_REPLICA_PROJECTS
def test_get_replica_projects_unset_returns_empty(monkeypatch) -> None:
"""No env var mea... | 71 | 2,837 |
deepagents | libs/code/tests/unit_tests/test_server_manager.py | .py | """Tests for server manager bootstrap behavior."""
from __future__ import annotations
import asyncio
import os
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock, call, patch
if TYPE_CHECKING:
from pathlib import Path
import pytest
from deepagents_code._env_vars import SERVER_ENV_P... | 777 | 30,847 |
deepagents | libs/code/tests/unit_tests/test_event_bus.py | .py | """Unit tests for the external event ingress."""
from __future__ import annotations
import asyncio
import json
import os
import socket
import tempfile
from pathlib import Path
import pytest
from deepagents_code.command_registry import BypassTier
from deepagents_code.event_bus import (
_MAX_LINE_BYTES,
Exter... | 446 | 16,092 |
deepagents | libs/code/tests/unit_tests/test_non_interactive.py | .py | """Tests for non-interactive mode HITL decision logic."""
import asyncio
import io
import logging
import signal
import sys
from collections.abc import AsyncIterator, Iterator, Sequence
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any
from unittest.mock import AsyncMock, ... | 4,006 | 152,550 |
deepagents | libs/code/tests/unit_tests/test_agent.py | .py | """Unit tests for agent formatting functions."""
import asyncio
import warnings
from collections.abc import Iterator, Mapping
from contextlib import contextmanager
from dataclasses import dataclass, fields
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any, cast
from unitt... | 6,389 | 246,683 |
deepagents | libs/code/tests/unit_tests/test_auth_store.py | .py | """Tests for the user-level provider credential store."""
from __future__ import annotations
import json
import os
import sys
from pathlib import Path
import pytest
from deepagents_code import auth_store
@pytest.fixture
def fake_home(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
"""Redirect `Path.... | 435 | 18,765 |
deepagents | libs/code/tests/unit_tests/test_sandbox_factory.py | .py | """Tests for sandbox factory optional dependency handling."""
from __future__ import annotations
import os
import sys
from unittest.mock import MagicMock, patch
import pytest
from deepagents_code.integrations.sandbox_config import SandboxConfig
from deepagents_code.integrations.sandbox_factory import (
_VERCEL_... | 1,424 | 52,729 |
deepagents | libs/code/tests/unit_tests/test_coding_agent_metadata.py | .py | """Contract tests for the coding-agent-v1 trace-metadata standard.
These load the machine-readable contract (`validator.json`, vendored under
`data/`) and assert that the metadata Deep Agents Code stamps onto its
LangGraph stream config satisfies the contract — required keys, types,
allowed values, and the run-type `a... | 278 | 10,585 |
deepagents | libs/code/tests/unit_tests/test_doctor.py | .py | """Unit tests for the `dcode doctor` command."""
import argparse
import io
import json
import sys
import time
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from rich.console import Console
from deepagents_code.doctor import (
DiagnosticItem,
Diagnost... | 838 | 34,543 |
deepagents | libs/code/tests/unit_tests/test_install_script.py | .py | """Tests for the shell install script argument construction."""
from __future__ import annotations
import os
import pty
import re
import stat
import subprocess
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from collections.abc import Callable
SCRIPT = Path(__file__).... | 6,633 | 243,931 |
deepagents | libs/code/tests/unit_tests/test_ui.py | .py | """Unit tests for UI rendering utilities."""
import argparse
import pytest
from deepagents_code.config import get_glyphs
from deepagents_code.tool_display import (
_format_content_block,
_format_timeout,
format_tool_display,
format_tool_message_content,
truncate_value,
)
from deepagents_code.ui i... | 422 | 17,529 |
deepagents | libs/code/tests/unit_tests/test_sandbox_config.py | .py | """Tests for `[sandboxes]` config parsing."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any, cast
from deepagents_code.integrations.sandbox_config import SandboxConfig
if TYPE_CHECKING:
from pathlib import Path
import pytest
def _write(tmp_path: Path, content: st... | 141 | 4,465 |
deepagents | libs/code/tests/unit_tests/test_server_graph.py | .py | """Tests for server graph MCP loading behavior."""
from __future__ import annotations
import importlib
import os
import sys
import threading
from types import ModuleType, SimpleNamespace
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from deepagents_code._env_vars import SERVER_ENV_PREFIX
from ... | 632 | 24,016 |
deepagents | libs/code/tests/unit_tests/test_startup_blocking.py | .py | """Smoke tests for blocking calls during server startup."""
from __future__ import annotations
import asyncio
import builtins
import sys
import time
from typing import TYPE_CHECKING
import pytest
from blockbuster import BlockingError, blockbuster_ctx
import deepagents_code
from deepagents_code.mcp_tools import _war... | 73 | 2,713 |
deepagents | libs/code/tests/unit_tests/test_threads_resume.py | .py | """Unit tests for in-TUI `/threads -r` resume and previous-thread tracking."""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock, patch
from textual.widget import MountError
from deepagents_code.app import (
DeepAgentsApp,
TextualSessionState,... | 534 | 21,554 |
deepagents | libs/code/tests/unit_tests/test_formatting.py | .py | """Tests for formatting module."""
from __future__ import annotations
import locale
import os
import time
from contextlib import contextmanager
from datetime import datetime
from typing import TYPE_CHECKING
import pytest
from deepagents_code.formatting import (
format_duration,
format_message_timestamp,
... | 227 | 7,477 |
deepagents | libs/code/tests/unit_tests/test_config_manifest.py | .py | """Drift, resolution, and behavior tests for the configuration manifest.
These guard the contract that the manifest is the single source of truth for
the scalar config surface, that its resolver matches what the runtime reads,
and that secret-flagged options are never rendered by value.
"""
from __future__ import ann... | 3,091 | 119,508 |
deepagents | libs/code/tests/unit_tests/test_transcript_virtualization.py | .py | """Focused TUI tests for transcript virtualization scroll hydration.
These bind the behavior that history hydration is driven by real changes to the
chat's vertical scroll offset (`_ChatScroll.watch_scroll_y` -> the
`_ChatScroll.Scrolled` message -> `DeepAgentsApp.on_chat_scrolled`), rather than
the scrollbar `ScrollU... | 241 | 9,798 |
deepagents | libs/code/tests/unit_tests/test_file_ops.py | .py | import logging
import shutil
import textwrap
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING, cast
from unittest import mock
import pytest
from langchain_core.messages import ToolMessage
from deepagents_code.diff_utils import (
DiffStats,
count_diff_change_lines,
... | 1,137 | 40,814 |
deepagents | libs/code/tests/unit_tests/test_state_migration.py | .py | """Tests for the legacy-state migration helper."""
from __future__ import annotations
import json
from pathlib import Path
from typing import TYPE_CHECKING
from deepagents_code.state_migration import migrate_legacy_state
if TYPE_CHECKING:
import pytest
def _snapshot(state_dir: Path) -> list[tuple[str, bytes |... | 205 | 8,182 |
deepagents | libs/code/tests/unit_tests/test_auto_mode.py | .py | """Tests for classifier-backed Auto mode policy and routing."""
from __future__ import annotations
import asyncio
import json
import os
import tempfile
import threading
from dataclasses import dataclass
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any, Literal, cast, ge... | 5,109 | 169,014 |
deepagents | libs/code/tests/unit_tests/test_remote_client.py | .py | """Tests for RemoteAgent, _convert_message_data, and helpers."""
import uuid
from collections.abc import Sequence
from types import SimpleNamespace
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from langchain_core.messages import AIMessageChunk, HumanMessage, ToolMessage
... | 1,077 | 41,242 |
deepagents | libs/code/tests/unit_tests/test_memory_guard.py | .py | """Tests for the managed onboarding-name memory guard middleware."""
from __future__ import annotations
import os
import threading
from typing import TYPE_CHECKING, Any, cast
import pytest
from langchain_core.messages import ToolMessage
from langgraph.prebuilt.tool_node import ToolCallRequest
from deepagents_code.m... | 524 | 19,684 |
deepagents | libs/code/tests/unit_tests/test_install_command.py | .py | """Tests for the `/install <extra>` slash command and `--install` flag handler.
The CLI-flag side is covered by `test_main_args.TestInstallExtraSubcommand`;
this module focuses on the in-app slash dispatch in `DeepAgentsApp`.
"""
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from uni... | 1,333 | 55,663 |
deepagents | libs/code/tests/unit_tests/test_goal_tools.py | .py | """Unit tests for goal tools middleware."""
import json
from collections.abc import Callable
from types import SimpleNamespace
from typing import Any, cast, get_type_hints
import pytest
from langchain.agents.middleware.types import AgentState, PrivateStateAttr
from langchain_core.messages import AIMessage, HumanMessa... | 688 | 23,507 |
deepagents | libs/code/tests/unit_tests/test_openai_codex_integration.py | .py | """Unit tests for `deepagents_code.integrations.openai_codex`.
Covers status detection, build-model wiring, and the orchestration of the
browser-loopback OAuth flow without ever hitting the network or opening a
real browser.
"""
from __future__ import annotations
import asyncio
import json
import os
import secrets
i... | 693 | 24,458 |
deepagents | libs/code/tests/unit_tests/test_mcp_login_service.py | .py | """Tests for the UI-agnostic MCP login service layer."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from unittest.mock import patch
from deepagents_code.mcp_login_service import (
ConfigErrorKind,
ConfigResolution,
ConfigResolutionError,
ServerSelecti... | 787 | 31,951 |
deepagents | libs/code/tests/unit_tests/test_server_helpers.py | .py | """Tests for extracted helper functions in server.py."""
from __future__ import annotations
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from deepagents_code.agent import _apply_inherited_pythonpath
from deepagents_code.client.launch.server import (
_SERVER_ENV_DENYLIST,
... | 176 | 6,478 |
deepagents | libs/code/tests/unit_tests/test_paths.py | .py | """Unit tests for `deepagents_code._paths`."""
from pathlib import Path
import pytest
from deepagents_code._paths import PathState, classify_path
class TestClassifyPath:
"""Tests for the shared path classifier."""
def test_existing_path(self, tmp_path: Path) -> None:
"""A path that exists classifi... | 45 | 1,672 |
deepagents | libs/code/tests/unit_tests/test_editor.py | .py | """Tests for the external editor module."""
from __future__ import annotations
import pathlib
from typing import TYPE_CHECKING
from unittest.mock import MagicMock, patch
if TYPE_CHECKING:
import pytest
from deepagents_code.editor import (
EDITOR_DISPLAY_NAME_MAX_LENGTH,
GUI_WAIT_FLAG,
VIM_EDITORS,
... | 348 | 13,457 |
deepagents | libs/code/tests/unit_tests/test_diff_utils.py | .py | """Tests for `deepagents_code.diff_utils`."""
from __future__ import annotations
from typing import Any
import pytest
from deepagents_code.diff_utils import (
DIFF_TRUNCATION_MARKER,
DiffStats,
count_diff_change_lines,
file_header_indexes,
is_truncation_marker,
split_diff_lines,
)
def _dif... | 243 | 8,901 |
deepagents | libs/code/tests/unit_tests/test_managed_tools.py | .py | """Unit tests for `deepagents_code.managed_tools`."""
from __future__ import annotations
import hashlib
import io
import os
import subprocess
import tarfile
import warnings
import zipfile
from email.message import Message
from pathlib import Path
from unittest import mock
import pytest
from deepagents_code import m... | 1,010 | 37,322 |
deepagents | libs/code/tests/unit_tests/test_terminal_progress_preference.py | .py | """Tests for terminal `OSC 9;4` progress preference loading."""
from __future__ import annotations
from typing import TYPE_CHECKING
from deepagents_code.app import (
_load_terminal_progress_preference,
)
if TYPE_CHECKING:
from pathlib import Path
import pytest
class TestLoadTerminalProgressPreference... | 69 | 2,732 |
deepagents | libs/code/tests/unit_tests/test_mcp_oauth_ui.py | .py | """Tests proving MCP OAuth login can be driven without stdin/stdout.
These tests use a programmable `RecordingOAuthInteraction` in place of
the CLI prompt surface. They demonstrate that any TUI or test surface
can satisfy the `OAuthInteraction` Protocol and drive `mcp_auth.login`
end-to-end without touching `builtins.... | 423 | 15,717 |
deepagents | libs/code/tests/unit_tests/test_resume_state.py | .py | """Tests for resume-state persistence and token display callbacks."""
from types import SimpleNamespace
from typing import Any, cast, get_type_hints
import pytest
from langchain.agents.middleware.types import PrivateStateAttr
from langchain_core.messages import AIMessage, HumanMessage
from deepagents_code._session_s... | 755 | 27,224 |
deepagents | libs/code/tests/unit_tests/test_mcp_tools.py | .py | """Tests for MCP tool loading, caching, and config resolution."""
from __future__ import annotations
import asyncio
import json
import logging
import sys
import threading
import time
from contextlib import asynccontextmanager
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
from unittest.mock impo... | 5,572 | 212,664 |
deepagents | libs/code/tests/unit_tests/test_reliable_rubric.py | .py | """Tests for transient rubric grader transport retries."""
from collections.abc import Callable, Iterator, Sequence
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any, cast
from unittest.mock import AsyncMock, MagicMock
import httpx
import pytest
from deepagents.graph import create_deep_agent
fro... | 506 | 18,161 |
deepagents | libs/code/tests/unit_tests/test_shell_allow_list.py | .py | """Tests for shell command allow-list functionality."""
import pytest
from deepagents_code.config import (
SHELL_ALLOW_ALL,
contains_dangerous_patterns,
is_shell_command_allowed,
)
@pytest.fixture
def basic_allow_list() -> list[str]:
"""Basic allow-list with common read-only commands."""
return ... | 720 | 23,095 |
deepagents | libs/code/tests/unit_tests/test_main.py | .py | """Unit tests for main entry point."""
import asyncio
import inspect
import os
import signal
import sys
from collections.abc import Callable, Iterator
from io import StringIO
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any
from unittest.mock import AsyncMock, MagicMock,... | 5,832 | 229,691 |
deepagents | libs/code/tests/unit_tests/test_goal_rubric.py | .py | """Tests for server-side goal-criteria drafting helpers."""
from __future__ import annotations
import ast
import asyncio
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any, cast
from unittest.mock import AsyncMock, MagicMock, call, patch
import pytest
from deepagents.backends.local_shell import ... | 2,293 | 84,569 |
deepagents | libs/code/tests/unit_tests/test_local_context.py | .py | """Tests for local context middleware."""
from __future__ import annotations
import os
import shutil
import subprocess
from typing import TYPE_CHECKING, Any
from unittest.mock import AsyncMock, Mock
if TYPE_CHECKING:
from pathlib import Path
import pytest
from deepagents.backends import LocalShellBackend
from d... | 2,149 | 82,242 |
deepagents | libs/code/tests/unit_tests/test_output.py | .py | """Tests for the JSON output utility."""
import json
from io import StringIO
from pathlib import Path
from unittest.mock import patch
from deepagents_code.output import write_json
class TestWriteJson:
"""Tests for write_json envelope format."""
def test_envelope_structure(self) -> None:
"""Output h... | 63 | 2,203 |
deepagents | libs/code/tests/unit_tests/test_auth_display.py | .py | """Tests for shared auth status rendering."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from collections.abc import Iterator
from pathlib import Path
from deepagents_code import model_config
from deepagents_code.auth_display import format_auth_badge... | 239 | 7,685 |
deepagents | libs/code/tests/unit_tests/test_charset.py | .py | """Tests for charset mode configuration and glyph selection."""
import os
import sys
from unittest.mock import Mock, patch
import pytest
from deepagents_code._env_vars import HIDE_SPLASH_VERSION
from deepagents_code.config import (
_ASCII_BANNER,
_UNICODE_BANNER,
ASCII_GLYPHS,
UNICODE_GLYPHS,
Cha... | 366 | 14,484 |
deepagents | libs/code/tests/unit_tests/test_hooks.py | .py | """Tests for the hooks dispatch module."""
from __future__ import annotations
import asyncio
import json
import logging
import subprocess
from typing import TYPE_CHECKING, Any
from unittest.mock import MagicMock, patch
import pytest
if TYPE_CHECKING:
from collections.abc import Generator
import deepagents_code... | 601 | 23,598 |
deepagents | libs/code/tests/unit_tests/test_exception_handling.py | .py | """Tests for exception handling improvements in CLI modules.
These tests verify that:
1. Exceptions are properly logged at DEBUG level
2. Specific exception types are caught instead of bare Exception
3. The code behaves correctly when exceptions occur
4. Tavily-specific exceptions are handled in web_search
"""
import... | 269 | 11,110 |
deepagents | libs/code/tests/unit_tests/test_textual_patches.py | .py | """Tests for the Textual keyboard parser monkey-patch.
See `_textual_patches.py` and Textualize/textual#6378.
"""
from __future__ import annotations
import ast
import importlib.util
from pathlib import Path
import pytest
from textual import events
from textual._time import get_time
from textual._xterm_parser import... | 412 | 17,686 |
deepagents | libs/code/tests/unit_tests/test_sandbox_registry.py | .py | """Tests for sandbox provider discovery and the registry."""
from __future__ import annotations
import importlib.metadata
from typing import TYPE_CHECKING, Any
from unittest.mock import MagicMock
import pytest
from deepagents_code.integrations.sandbox_config import SandboxConfig
from deepagents_code.integrations.sa... | 314 | 11,003 |
deepagents | libs/code/tests/unit_tests/conftest.py | .py | """Shared fixtures for unit tests."""
from __future__ import annotations
import asyncio
import contextlib
import os
from typing import TYPE_CHECKING, Any, Protocol, cast
import pytest
if TYPE_CHECKING:
from collections.abc import Callable, Coroutine, Generator
from pathlib import Path
from textual.pilo... | 738 | 30,468 |
deepagents | libs/code/tests/unit_tests/client/commands/test_auth.py | .py | """Tests for the `dcode auth` CLI subcommands."""
from __future__ import annotations
import argparse
import io
import json
import subprocess
import sys
import textwrap
from pathlib import Path
from typing import IO, TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from collections.abc import Generator
from deepag... | 1,004 | 39,751 |
deepagents | libs/code/tests/unit_tests/client/commands/test_extras.py | .py | """Tests for the `dcode install` command and shared install helpers."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from deepagents_code.client.commands.extras import (
run_install_command,
run_ins... | 169 | 6,187 |
deepagents | libs/code/tests/unit_tests/client/commands/test_mcp.py | .py | """Tests for the `dcode mcp` command group."""
from __future__ import annotations
import argparse
from pathlib import Path
from typing import TYPE_CHECKING, Any
from unittest.mock import AsyncMock, patch
if TYPE_CHECKING:
from collections.abc import Callable
import pytest
def _build_parser() -> argparse.A... | 524 | 19,951 |
deepagents | libs/code/tests/unit_tests/client/commands/test_tools.py | .py | """Tests for the `dcode tools` command group."""
from __future__ import annotations
import argparse
import io
import json
from pathlib import Path
from unittest.mock import patch
import pytest
from rich.console import Console
from deepagents_code import managed_tools
from deepagents_code._env_vars import OFFLINE, R... | 600 | 23,206 |
deepagents | libs/code/tests/unit_tests/hooks/test_server_lifecycle.py | .py | """Unit tests for Hooks v2 server-owned lifecycle integration."""
from __future__ import annotations
import asyncio
import json
import sys
from datetime import UTC, datetime, timedelta
from pathlib import Path
from typing import TYPE_CHECKING, Any, NotRequired
from unittest.mock import MagicMock
from uuid import UUID... | 1,461 | 48,927 |
deepagents | libs/code/tests/unit_tests/hooks/test_configuration.py | .py | """Unit tests for Hooks v2 configuration and snapshots."""
from __future__ import annotations
import io
import json
import sys
from typing import TYPE_CHECKING
from unittest.mock import MagicMock
import pytest
from pydantic import ValidationError
from deepagents_code.hooks import migration
from deepagents_code.hook... | 502 | 16,653 |
deepagents | libs/code/tests/unit_tests/hooks/test_transcript.py | .py | """Unit tests for Hooks v2 transcripts and session runtime."""
from __future__ import annotations
import json
import os
import stat
import sys
from concurrent.futures import ThreadPoolExecutor
from typing import TYPE_CHECKING
import pytest
from langchain_core.messages import AIMessage, AIMessageChunk, HumanMessage
... | 366 | 12,789 |
deepagents | libs/code/tests/unit_tests/hooks/test_engine.py | .py | """Unit tests for the Hooks v2 execution engine."""
from __future__ import annotations
import json
import subprocess
import sys
from typing import TYPE_CHECKING
from uuid import uuid4
import pytest
from langchain_core.messages import ToolMessage
from langgraph.types import Command
from deepagents_code.approval_mode... | 1,741 | 53,872 |
deepagents | libs/code/tests/unit_tests/hooks/test_execution.py | .py | """Unit tests for Hooks v2 execution safety and policies."""
from __future__ import annotations
import asyncio
import os
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock
import pytest
from deepagents_code.approval_mode import ApprovalMode
from deepagents_code.hooks import runner
from ... | 404 | 12,634 |
deepagents | libs/code/tests/unit_tests/hooks/test_manager.py | .py | """Tests for `HooksManager` ownership of the shared presenter."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING
from deepagents_code.approval_mode import ApprovalMode
from deepagents_code.hooks.manager import HookSessionIdentity, HooksManager
from deepagents_code.hooks.models.domain... | 120 | 3,815 |
deepagents | libs/code/tests/unit_tests/hooks/test_trust.py | .py | """Tests for project-hook workspace trust."""
from __future__ import annotations
import json
import os
from concurrent.futures import ThreadPoolExecutor
from dataclasses import replace
from typing import TYPE_CHECKING
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from deepagents_code.approval_... | 688 | 22,945 |
deepagents | libs/code/tests/unit_tests/hooks/test_client_lifecycle.py | .py | """Unit tests for client-owned Hooks v2 lifecycle integration."""
from __future__ import annotations
from collections import deque
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Literal
from uuid import UUID, uuid4
import pytest
from deepagents_code.approval_mode import ApprovalMode
from... | 188 | 5,849 |
deepagents | libs/code/tests/unit_tests/hooks/test_presenter.py | .py | """Tests for the shared Hooks v2 presenter."""
from __future__ import annotations
from deepagents_code.hooks.models.domain import HookEvent, PermissionEffect
from deepagents_code.hooks.presenter import (
HookNoticeSeverity,
HookPresenter,
HookProgress,
)
def _progress(
operation_id: str,
message... | 81 | 2,147 |
deepagents | libs/code/tests/unit_tests/hooks/models/test_models.py | .py | """Contract tests for hooks data models."""
from datetime import UTC, datetime
from pathlib import Path
from uuid import UUID, uuid4
import pytest
from langchain_core.messages import ToolMessage
from pydantic import ValidationError
from deepagents_code.approval_mode import ApprovalMode
from deepagents_code.hooks.mod... | 494 | 14,323 |
deepagents | libs/code/tests/unit_tests/tools/test_current_thread.py | .py | """Tests for the `get_current_thread_id` tool."""
from __future__ import annotations
from deepagents_code.tools import get_current_thread_id
def test_get_current_thread_id_returns_config_thread() -> None:
"""Tool should read the injected LangGraph thread ID."""
result = get_current_thread_id.invoke(
... | 28 | 891 |
deepagents | libs/code/tests/unit_tests/tools/test_tool_arg_schemas.py | .py | """Ensure first-party tools expose per-argument schema descriptions."""
from __future__ import annotations
from collections.abc import Callable
from typing import TYPE_CHECKING, Annotated
from unittest.mock import Mock
import pytest
from langchain_core.tools import BaseTool, StructuredTool, tool
from langchain_core.... | 150 | 5,434 |
deepagents | libs/code/tests/unit_tests/tools/test_fetch_url.py | .py | """Tests for the `fetch_url` tool."""
from __future__ import annotations
import socket
from typing import TYPE_CHECKING, Any
from unittest import mock
import markdownify as markdownify_module
import pytest
import requests
import responses
from deepagents_code import tools
from deepagents_code.tools import (
_ht... | 606 | 18,734 |
deepagents | libs/code/tests/unit_tests/smoke_tests/test_system_prompt.py | .py | """Snapshot test for the CLI agent system prompt.
Snapshots the full system message the model receives on first invocation,
including middleware-injected sections (local context, memory, skills).
Machine-specific values (cwd, local-context detection output) are fixed
so the golden file is reproducible across machines.... | 208 | 7,806 |
deepagents | libs/code/tests/unit_tests/smoke_tests/conftest.py | .py | """Shared fixtures for smoke-test snapshots."""
from __future__ import annotations
from pathlib import Path
import pytest
def pytest_addoption(parser: pytest.Parser) -> None:
parser.addoption(
"--update-snapshots",
action="store_true",
default=False,
help="Update smoke test snap... | 29 | 641 |
deepagents | libs/code/tests/unit_tests/tui/test_textual_adapter.py | .py | """Unit tests for textual_adapter functions."""
import asyncio
import sys
from asyncio import Future
from collections.abc import AsyncIterator, Awaitable, Callable, Generator
from datetime import datetime
from pathlib import Path
from time import time
from types import SimpleNamespace
from typing import TYPE_CHECKING,... | 10,843 | 411,443 |
deepagents | libs/code/tests/unit_tests/tui/test_subagent_stream.py | .py | """Unit tests for the subagent custom-stream boundary filter.
`_is_renderable_subagent_event` is the trust boundary between the agent's
`custom` stream and the live panel: only well-formed subagent events from the
main agent's namespace are forwarded.
"""
from __future__ import annotations
from deepagents_code.tui.t... | 42 | 1,421 |
deepagents | libs/code/tests/unit_tests/tui/widgets/test_subagent_panel.py | .py | """Behavioral tests for the SubagentPanel widget.
Each test mounts the panel in a minimal App, feeds it realistic subagent
lifecycle events, and asserts on rendered content / observable state — not on
types. Uses the Textual `run_test()` pilot harness.
"""
from __future__ import annotations
from typing import TYPE_C... | 549 | 23,631 |
deepagents | libs/code/tests/unit_tests/tui/widgets/test_autocomplete.py | .py | """Tests for autocomplete fuzzy search functionality."""
import asyncio
import logging
import subprocess
import threading
from pathlib import Path
from typing import cast
from unittest.mock import MagicMock
import pytest
from deepagents_code.command_registry import CommandEntry, get_slash_commands
from deepagents_co... | 1,421 | 54,696 |
deepagents | libs/code/tests/unit_tests/tui/widgets/test_history.py | .py | """Unit tests for HistoryManager."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from pathlib import Path
from deepagents_code.tui.widgets.history import HistoryManager
@pytest.fixture
def history(tmp_path: Path) -> HistoryManager:
"""Create a Histo... | 335 | 12,878 |
deepagents | libs/code/tests/unit_tests/tui/widgets/test_status.py | .py | """Unit tests for the StatusBar widget."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from textual import events
from textual.app import App, ComposeResult
from textual.content import Content
from textual.geometry import Size
from textual.widgets import Static
from deepagents_... | 1,302 | 59,723 |
deepagents | libs/code/tests/unit_tests/tui/widgets/test_skill_trust_screen.py | .py | """Tests for the `SkillTrustScreen` out-of-bounds-skill approval modal."""
from __future__ import annotations
from textual.app import App, ComposeResult
from textual.widgets import Static
from deepagents_code.tui.widgets.skill_trust import SkillTrustScreen
class _SkillTrustTestApp(App[None]):
def compose(self)... | 79 | 3,074 |
deepagents | libs/code/tests/unit_tests/tui/widgets/test_cwd_switch.py | .py | """Tests for the cwd switch prompt screen."""
from __future__ import annotations
from typing import get_args
from unittest.mock import MagicMock
from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Static
from deepagents_code.tui.widgets.cwd_switch import (
... | 232 | 8,996 |
deepagents | libs/code/tests/unit_tests/tui/widgets/test_model_selector.py | .py | """Tests for ModelSelectorScreen."""
import asyncio
import tomllib
from collections.abc import Callable, Iterator, Mapping
from pathlib import Path
from typing import Any, ClassVar
from unittest.mock import MagicMock
import pytest
from textual.app import App, ComposeResult
from textual.binding import Binding, Binding... | 4,298 | 169,263 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.