repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
shotgun-sh/shotgun | import hashlib
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from unittest.mock import Mock, patch
import pytest
from shotgun.codebase.core.change_detector import ChangeDetector, ChangeType
@pytest.mark.asyncio
async def test_calculate_file_hash_nonexistent_file():
"""Test ... | "" | assert | string_literal | test/unit/codebase/test_change_detector.py | test_calculate_file_hash_nonexistent_file | 533 | null | |
shotgun-sh/shotgun | import tempfile
from pathlib import Path
import pytest
from shotgun.codebase.core.metrics_types import (
FileInfo,
FileParseTask,
WorkBatch,
)
from shotgun.codebase.core.parallel_executor import ParallelExecutor
from shotgun.codebase.core.work_distributor import WorkDistributor
from shotgun.codebase.core.... | 0 | assert | numeric_literal | test/integration/codebase/test_parallel_correctness.py | test_parallel_extracts_all_definitions | 121 | null | |
shotgun-sh/shotgun | from __future__ import annotations
from pathlib import Path
import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.models import GraphStatus, IndexProgress, ProgressPhase
@pytest.mark.integration
@pytest.mark.asyncio
async def test_codebase_index_command_works(
simple_python... | None | assert | none_literal | test/integration/codebase/test_regression.py | test_codebase_index_command_works | 35 | null | |
shotgun-sh/shotgun | import asyncio
import json
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from shotgun.agents.autopilot.claude_cli_subprocess import (
ClaudeCliSubprocess,
_format_team_tool,
)
from shotgun.agents.autopilot.claude_subprocess import ClaudeSubprocessConfig
from shotgun.agents.autopilot.mode... | cmd | assert | variable | test/unit/agents/autopilot/test_claude_cli_subprocess.py | test_cli_subprocess_builds_correct_command | 56 | null | |
shotgun-sh/shotgun | from datetime import datetime, timezone
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from shotgun.cli.spec.models import PullSource
from shotgun.cli.spec.pull_service import (
CancelledError,
PullProgress,
SpecPullService,
)
from shotgun.shotgun_web.models i... | props | assert | variable | test/unit/cli/spec/test_pull_service.py | test_pull_version_tracks_posthog_events | 344 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import codebase_shell
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_codebase_shell_ls_command(
indexed_graph: CodebaseGra... | True | assert | bool_literal | test/integration/codebase/tools/test_codebase_shell.py | test_codebase_shell_ls_command | 23 | null | |
shotgun-sh/shotgun | import zipfile
from pathlib import Path
import pytest
from shotgun.cli.spec.backup import clear_shotgun_dir, create_backup
def temp_shotgun_dir(tmp_path: Path) -> Path:
"""Create a temporary .shotgun directory with test files."""
shotgun_dir = tmp_path / ".shotgun"
shotgun_dir.mkdir()
# Create some ... | names | assert | variable | test/unit/cli/spec/test_backup.py | test_create_backup_includes_all_files | 60 | null | |
shotgun-sh/shotgun | import os
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.agents.tools.web_search import (
get_available_web_search_tools,
is_provider_available,
)
@pytest.mark.asyncio
async def test_get_available_web_search_tools_returns_list():
"""Test that get_available_web_search_too... | tool.__name__ | assert | complex_expr | test/integration/tools/web_search/test_web_search_availability.py | test_get_available_web_search_tools_returns_list | 25 | null | |
shotgun-sh/shotgun | import asyncio
from pathlib import Path
from unittest.mock import patch
import pytest
from shotgun.codebase.models import QueryType
from shotgun.sdk import CodebaseSDK
from shotgun.sdk.exceptions import CodebaseNotFoundError, InvalidPathError
@pytest.mark.integration
@pytest.mark.asyncio
async def test_list_codebase... | [] | assert | collection | test/integration/sdk/test_sdk_codebase.py | test_list_codebases_empty | 36 | null | |
shotgun-sh/shotgun | import json
import tempfile
from pathlib import Path
import pytest
from shotgun.agents.config.manager import (
CURRENT_CONFIG_VERSION,
ConfigManager,
_apply_migrations,
_create_backup,
_migrate_v2_to_v3,
_migrate_v3_to_v4,
_migrate_v4_to_v5,
_migrate_v6_to_v7,
_migrate_v7_to_v8,
... | 7 | assert | numeric_literal | test/unit/test_config_migrations.py | test_migrate_v6_to_v7 | 251 | null | |
shotgun-sh/shotgun | import pytest
from textual.app import App, ComposeResult
from shotgun.attachments import AttachmentHint, AttachmentType
from shotgun.tui.screens.chat_screen.attachment_hint import AttachmentHintWidget
def create_test_hint(
filename: str = "document.pdf",
file_type: AttachmentType = AttachmentType.PDF,
siz... | hint | assert | variable | test/unit/tui/screens/chat_screen/test_attachment_hint.py | test_attachment_hint_widget_initialization | 28 | null | |
shotgun-sh/shotgun | from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from shotgun.agents.autopilot.models import (
MonitorAction,
MonitorDecision,
)
from shotgun.agents.autopilot.stage_monitor import (
MonitorDeps,
StageMonitor,
)
def test_monitor_decision_status_summary_default():
"... | "" | assert | string_literal | test/unit/agents/autopilot/test_stage_monitor.py | test_monitor_decision_status_summary_default | 220 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.codebase.models import CodebaseGraph, GraphStatus, QueryResult
from shotgun.sdk.models import (
DeleteResult,
ErrorResult,
IndexResult,
InfoResult,
ListResult,
QueryCommandResult,
ReindexResult,
)
@pytest.mark.integration
def test_list_result_with_graphs():
"... | 0 | assert | numeric_literal | test/integration/sdk/test_sdk_models.py | test_list_result_with_graphs | 52 | null | |
shotgun-sh/shotgun | import hashlib
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from unittest.mock import Mock, patch
import pytest
from shotgun.codebase.core.change_detector import ChangeDetector, ChangeType
def test_get_file_nodes_no_nodes():
"""Test get_file_nodes with no nodes."""
moc... | set() | assert | func_call | test/unit/codebase/test_change_detector.py | test_get_file_nodes_no_nodes | 600 | null | |
shotgun-sh/shotgun | from __future__ import annotations
from pathlib import Path
from unittest.mock import patch
import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.core.metrics_types import (
FileParseTask,
WorkBatch,
)
from shotgun.codebase.core.parallel_executor import ParallelExecutor
... | 5 | assert | numeric_literal | test/integration/codebase/test_error_handling.py | test_all_files_fail_gracefully | 324 | null | |
shotgun-sh/shotgun | import base64
from pathlib import Path
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.attachments.models import AttachmentType, FileAttachment
from shotgun.attachments.processor import (
DEFAULT_SIZE_LIMIT,
PROVIDER_SIZE_LIMITS,
create_attachment_hint_display,
encode_... | "" | assert | string_literal | test/unit/attachments/test_attachment_processor.py | test_encode_file_to_base64_empty_file | 191 | null | |
shotgun-sh/shotgun | from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai import Agent
from pydantic_ai.agent import AgentRunResult
from pydantic_ai.messages import ModelMessage
from shotgun.agents.models import AgentDeps, AgentRuntimeOptions
from shotgun.agents.plan import create_plan_agent, run_plan_agent
from shot... | True | assert | bool_literal | test/unit/agents/test_agent_creation.py | test_create_plan_agent | 63 | null | |
shotgun-sh/shotgun | from __future__ import annotations
import hashlib
import json
import shutil
from pathlib import Path
import pytest
from shotgun.codebase.benchmarks import (
BenchmarkRunner,
MetricsDisplayOptions,
MetricsExporter,
get_formatter,
)
from shotgun.utils.file_system_utils import get_shotgun_home
def samp... | 0 | assert | numeric_literal | test/integration/codebase/test_benchmark_cli.py | test_benchmark_runner_basic | 120 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import directory_lister
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_directory_lister_root_directory(
indexed_graph: Cod... | 0 | assert | numeric_literal | test/integration/codebase/tools/test_directory_lister.py | test_directory_lister_root_directory | 26 | null | |
shotgun-sh/shotgun | from __future__ import annotations
import multiprocessing
import os
import sys
import tempfile
import threading
import time
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import TimeoutError as FuturesTimeoutError
from pathlib import Path
import psutil
import pytest
from shotgun.codebase.c... | 2 | assert | numeric_literal | test/integration/codebase/test_multiplatform.py | test_parallel_executor_initialization | 127 | null | |
shotgun-sh/shotgun | from asyncio import Queue
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from pydantic_ai import RunContext, RunUsage
from pydantic_ai.agent import AgentRunResult
from pydantic_ai.tools import ToolDefinition
from shotgun.agents.config.models import KeyProvider, ModelConfi... | "" | assert | string_literal | test/unit/agents/router/test_delegation.py | test_build_sub_agent_context_no_plan | 197 | null | |
shotgun-sh/shotgun | import multiprocessing
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from shotgun.codebase.core.ingestor import SimpleGraphBuilder
from shotgun.codebase.core.parser_loader import load_parsers
from shotgun.settings import settings
def sample_repo() -> Path:
"""C... | 3 | assert | numeric_literal | test/integration/codebase/test_indexer_integration.py | test_build_file_infos_creates_correct_objects | 197 | null | |
shotgun-sh/shotgun | import os
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.agents.tools.web_search import (
get_available_web_search_tools,
is_provider_available,
)
@pytest.mark.asyncio
async def test_no_tools_available_when_no_api_keys():
"""Test that no tools are available when no API k... | [] | assert | collection | test/integration/tools/web_search/test_web_search_availability.py | test_no_tools_available_when_no_api_keys | 54 | null | |
shotgun-sh/shotgun | import asyncio
from pathlib import Path
from unittest.mock import MagicMock
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
TextPart,
ToolCallPart,
UserPromptPart,
)
from shotgun.agents.agent_manager import AgentManager, AgentType
from shotgun.agents.models import Age... | [] | assert | collection | test/unit/agents/test_sub_agent_streaming.py | test_sub_agent_messages_list_initialized | 43 | null | |
shotgun-sh/shotgun | from unittest.mock import AsyncMock, MagicMock, patch
from shotgun import posthog_telemetry
from shotgun.posthog_telemetry import Feedback, FeedbackKind
def test_setup_posthog_already_initialized():
"""Test that setup returns True if already initialized."""
# Set the global client to simulate already initiali... | True | assert | bool_literal | test/unit/test_posthog_telemetry.py | test_setup_posthog_already_initialized | 17 | null | |
shotgun-sh/shotgun | import sys
from unittest.mock import Mock, patch
from shotgun.utils.update_checker import (
UpdateInfo,
check_for_update,
compare_versions,
detect_installation_method,
get_latest_version,
get_update_command,
get_upgrade_hint,
is_dev_version,
perform_auto_update,
perform_auto_upd... | True | assert | bool_literal | test/unit/test_update_checker.py | test_is_dev_version | 23 | null | |
shotgun-sh/shotgun | from __future__ import annotations
import multiprocessing
import os
import sys
import tempfile
import threading
import time
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import TimeoutError as FuturesTimeoutError
from pathlib import Path
import psutil
import pytest
from shotgun.codebase.c... | 0 | assert | numeric_literal | test/integration/codebase/test_multiplatform.py | test_psutil_memory_info_works | 76 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import file_read
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_file_read_empty_file_path(
indexed_graph: CodebaseGraph,
... | "" | assert | string_literal | test/integration/codebase/tools/test_file_read.py | test_file_read_empty_file_path | 338 | null | |
shotgun-sh/shotgun | import asyncio
import json
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from shotgun.agents.autopilot.claude_cli_subprocess import (
ClaudeCliSubprocess,
_format_team_tool,
)
from shotgun.agents.autopilot.claude_subprocess import ClaudeSubprocessConfig
from shotgun.agents.autopilot.mode... | env | assert | variable | test/unit/agents/autopilot/test_claude_cli_subprocess.py | test_cli_subprocess_passes_env_vars | 93 | null | |
shotgun-sh/shotgun | import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from pydantic import SecretStr
from shotgun.agents.config.manager import ConfigManager
from shotgun.agents.config.models import (
KeyProvider,
ModelName,
OpenAIConfig,
ProviderType... | KeyProvider.BYOK | assert | complex_expr | test/unit/test_streaming_detection.py | test_get_provider_model_gpt5_byok_not_tested | 154 | null | |
shotgun-sh/shotgun | import os
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.agents.tools.web_search import (
is_provider_available,
openai_web_search_tool,
)
@pytest.mark.asyncio
@pytest.mark.skipif(not os.getenv("OPENAI_API_KEY"), reason="OpenAI API key not set")
async def test_openai_web_sea... | 0 | assert | numeric_literal | test/integration/tools/web_search/test_openai_search.py | test_openai_web_search_smoke | 27 | null | |
shotgun-sh/shotgun | from shotgun.agents.autopilot.models import (
AutopilotMode,
AutopilotState,
ClaudeOutput,
ClaudeOutputType,
Stage,
StageStatus,
Task,
)
def test_stage_creation():
"""Test Stage model creation with tasks."""
tasks = [
Task(text="Task 1", completed=False, line_number=10),
... | "1" | assert | string_literal | test/unit/agents/autopilot/test_models.py | test_stage_creation | 62 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.sdk.services import get_codebase_service
@pytest.mark.integration
def test_get_codebase_service_default_storage(isolated_shotgun_home):
"""Test get_codebase_service with default storage directory."""
service = get_codebase_service()
assert service is not | None | assert | none_literal | test/integration/sdk/test_sdk_services.py | test_get_codebase_service_default_storage | 13 | null | |
shotgun-sh/shotgun | from shotgun.agents.config.models import (
MODEL_SPECS,
SUB_AGENT_MODEL_MAPPINGS,
ModelName,
get_sub_agent_model,
)
def test_unmapped_models_return_self():
"""Ensure models not in the mapping return themselves."""
# Get all models that are NOT in the mapping keys
unmapped_models = [m for m ... | model | assert | variable | test/unit/agents/config/test_sub_agent_models.py | test_unmapped_models_return_self | 90 | null | |
shotgun-sh/shotgun | from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
TextPart,
UserPromptPart,
)
from pydantic_ai.usage import RequestUsage
from shotgun.agents.conversation.history.compaction import (
apply_persistent_compaction,
)
fro... | 1 | assert | numeric_literal | test/unit/test_compaction.py | test_estimate_tokens_hybrid_uses_api_plus_delta | 182 | null | |
shotgun-sh/shotgun | from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai import RunContext
from pydantic_ai.messages import (
BuiltinToolCallPart,
BuiltinToolReturnPart,
ModelRequest,
ModelResponse,
RetryPromptPart,
SystemPromptPart,
TextPart,
ThinkingPart,
ToolCallPart,
ToolRe... | 5 | assert | numeric_literal | test/unit/test_history_processors.py | test_find_last_summary_index | TestSummaryDetection | 732 | null |
shotgun-sh/shotgun | from pathlib import Path
import pytest
from shotgun.agents.autopilot.autopilot_orchestrator import (
AutopilotConfig,
AutopilotOrchestrator,
)
from shotgun.agents.autopilot.models import (
AutopilotMode,
Stage,
StageStatus,
Task,
)
def test_advance_to_next_stage():
"""Test advancing throu... | "1" | assert | string_literal | test/unit/agents/autopilot/test_autopilot_orchestrator.py | test_advance_to_next_stage | 77 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import codebase_shell
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_codebase_shell_ls_command(
indexed_graph: CodebaseGra... | None | assert | none_literal | test/integration/codebase/tools/test_codebase_shell.py | test_codebase_shell_ls_command | 25 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.models import GraphStatus
@pytest.mark.integration
@pytest.mark.asyncio
async def test_create_graph(service: CodebaseService, simple_python_codebase):
"""Test creating a graph from a codebase."""
graph = await service.... | 1 | assert | numeric_literal | test/integration/codebase/test_codebase_service.py | test_create_graph | 43 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import file_read
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_file_read_main_file(
indexed_graph: CodebaseGraph,
run... | True | assert | bool_literal | test/integration/codebase/tools/test_file_read.py | test_file_read_main_file | 23 | null | |
shotgun-sh/shotgun | from datetime import datetime
from unittest.mock import AsyncMock, Mock, patch
import httpx
import pytest
from shotgun.tui.services.ollama import (
DEFAULT_OLLAMA_URL,
OllamaModel,
OllamaStatus,
get_ollama_status,
sanitize_ollama_model_name_for_id,
)
from shotgun.utils import format_file_size
def... | "0 B" | assert | string_literal | test/unit/tui/services/test_ollama.py | test_format_file_size_bytes | 21 | null | |
shotgun-sh/shotgun | import asyncio
from pathlib import Path
from unittest.mock import patch
import pytest
from shotgun.codebase.models import QueryType
from shotgun.sdk import CodebaseSDK
from shotgun.sdk.exceptions import CodebaseNotFoundError, InvalidPathError
@pytest.mark.integration
@pytest.mark.asyncio
async def test_index_codebas... | 0 | assert | numeric_literal | test/integration/sdk/test_sdk_codebase.py | test_index_codebase_success | 51 | null | |
shotgun-sh/shotgun | import os
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.agents.tools.web_search import (
anthropic_web_search_tool,
is_provider_available,
)
@pytest.mark.asyncio
@pytest.mark.skipif(
not os.getenv("ANTHROPIC_API_KEY"), reason="Anthropic API key not set"
)
async def test... | 0 | assert | numeric_literal | test/integration/tools/web_search/test_anthropic_search.py | test_anthropic_web_search_smoke | 29 | null | |
shotgun-sh/shotgun | from functools import partial
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from pydantic_ai.models.test import TestModel
from shotgun.agents.common import build_agent_system_prompt, create_base_agent
from shotgun.agents.config.models import (
ModelConfig,
ModelName,
ProviderType,
)
... | "1h" | assert | string_literal | test/unit/agents/test_anthropic_cache_settings.py | test_sub_agent_caches_messages_at_5m | 71 | null | |
shotgun-sh/shotgun | from pathlib import Path
from shotgun.codebase.core.errors import (
DatabaseCorruptedError,
DatabaseIssue,
DatabaseLockedError,
DatabaseSchemaError,
DatabaseTimeoutError,
KuzuErrorType,
classify_kuzu_error,
)
class TestDatabaseExceptions:
def test_database_corrupted_error(self):
... | str(error) | assert | func_call | test/unit/codebase/test_kuzu_errors.py | test_database_corrupted_error | TestDatabaseExceptions | 145 | null |
shotgun-sh/shotgun | import asyncio
from pathlib import Path
from unittest.mock import patch
import pytest
from shotgun.codebase.models import QueryType
from shotgun.sdk import CodebaseSDK
from shotgun.sdk.exceptions import CodebaseNotFoundError, InvalidPathError
@pytest.mark.integration
@pytest.mark.asyncio
async def test_delete_codeba... | True | assert | bool_literal | test/integration/sdk/test_sdk_codebase.py | test_delete_codebase_no_confirmation | 126 | null | |
shotgun-sh/shotgun | import time
from pathlib import Path
from shotgun.logging_config import cleanup_old_log_files
def test_cleanup_old_log_files_keeps_exactly_one(tmp_path: Path) -> None:
"""Test that cleanup can keep just 1 file."""
# Create 5 log files
log_files = []
for i in range(5):
log_file = tmp_path / f"s... | 1 | assert | numeric_literal | test/unit/test_logging_config.py | test_cleanup_old_log_files_keeps_exactly_one | 110 | null | |
shotgun-sh/shotgun | import importlib
import os
import sys
from unittest.mock import MagicMock, patch
import pytest
def clean_env(monkeypatch, tmp_path):
"""Clean SHOTGUN_ environment variables before each test."""
# Remove all SHOTGUN_ prefixed environment variables
for key in list(os.environ.keys()):
if key.startswi... | "" | assert | string_literal | test/unit/test_settings.py | test_build_constants_import_error_handled | 305 | null | |
shotgun-sh/shotgun | import json
import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from pydantic import SecretStr
from shotgun.agents.config.constants import (
API_KEY_FIELD,
CONFIG_VERSION_FIELD,
SHOTGUN_INSTANCE_ID_FIELD,
ConfigSection,
)
from shotgun.agents.config.manager ... | None | assert | none_literal | test/unit/test_config_manager.py | test_init_default_path | 45 | null | |
shotgun-sh/shotgun | import importlib
import os
import sys
from unittest.mock import MagicMock, patch
import pytest
def clean_env(monkeypatch, tmp_path):
"""Clean SHOTGUN_ environment variables before each test."""
# Remove all SHOTGUN_ prefixed environment variables
for key in list(os.environ.keys()):
if key.startswi... | True | assert | bool_literal | test/unit/test_settings.py | test_telemetry_settings_from_env | 61 | null | |
shotgun-sh/shotgun | import json
import tempfile
from pathlib import Path
import pytest
from shotgun.agents.config.manager import (
CURRENT_CONFIG_VERSION,
ConfigManager,
_apply_migrations,
_create_backup,
_migrate_v2_to_v3,
_migrate_v3_to_v4,
_migrate_v4_to_v5,
_migrate_v6_to_v7,
_migrate_v7_to_v8,
... | 4 | assert | numeric_literal | test/unit/test_config_migrations.py | test_migrate_v3_to_v4 | 195 | null | |
shotgun-sh/shotgun | import pytest
from textual.app import App
from shotgun.tui.components.prompt_input import PromptInput
pytestmark = pytest.mark.asyncio
async def test_backspace_after_clearing_input_does_not_crash() -> None:
"""Test that backspace works safely after typing and deleting all text."""
class TestApp(App):
... | "hi" | assert | string_literal | test/unit/tui/components/test_prompt_input.py | test_backspace_after_clearing_input_does_not_crash | 137 | null | |
shotgun-sh/shotgun | from shotgun.agents.constants import (
BINARY_EXTENSIONS,
MAX_BINARY_FILE_SIZE_BYTES,
MAX_TEXT_FILE_SIZE_BYTES,
MIME_TYPES,
TEXT_EXTENSIONS,
get_mime_type,
is_binary_extension,
is_supported_extension,
is_text_extension,
)
def test_is_binary_extension_pdf():
"""Test is_binary_ext... | True | assert | bool_literal | test/unit/agents/test_file_types_constants.py | test_is_binary_extension_pdf | 42 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai.messages import ToolCallPart
from shotgun.agents.tools.registry import (
_TOOL_DISPLAY_REGISTRY,
ToolDisplayConfig,
)
from shotgun.tui.screens.chat_screen.history.formatters import ToolFormatter
def cleanup_registry():
"""Clean up test tools from registry after each test."""... | "" | assert | string_literal | test/unit/tui/screens/chat_screen/history/test_formatters.py | test_format_tool_call_part_hidden_tool | 127 | null | |
shotgun-sh/shotgun | from datetime import datetime, timezone
import pytest
from shotgun.agents.config.models import MarketingConfig, MarketingMessageRecord
from shotgun.agents.models import FileOperation, FileOperationType
from shotgun.utils.marketing import (
GITHUB_STAR_MESSAGE_ID,
SPEC_FILES,
MarketingManager,
)
def test_... | result.messages | assert | complex_expr | test/unit/test_marketing.py | test_mark_message_shown | 136 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.models import GraphStatus
@pytest.mark.integration
@pytest.mark.asyncio
async def test_create_graph(service: CodebaseService, simple_python_codebase):
"""Test creating a graph from a codebase."""
graph = await service.... | 0 | assert | numeric_literal | test/integration/codebase/test_codebase_service.py | test_create_graph | 38 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import directory_lister
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_directory_lister_root_directory(
indexed_graph: Cod... | None | assert | none_literal | test/integration/codebase/tools/test_directory_lister.py | test_directory_lister_root_directory | 25 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import codebase_shell
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_codebase_shell_ls_command(
indexed_graph: CodebaseGra... | "ls" | assert | string_literal | test/integration/codebase/tools/test_codebase_shell.py | test_codebase_shell_ls_command | 24 | null | |
shotgun-sh/shotgun | import os
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.agents.tools.web_search import (
get_available_web_search_tools,
is_provider_available,
)
@pytest.mark.asyncio
async def test_prefers_gemini_when_google_key_available():
"""Test that Gemini is preferred when a Goog... | tools[0].__name__ | assert | complex_expr | test/integration/tools/web_search/test_web_search_availability.py | test_prefers_gemini_when_google_key_available | 36 | null | |
shotgun-sh/shotgun | from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from pydantic_ai import RunUsage
from pydantic_ai.messages import ModelResponse, TextPart
from pydantic_ai.usage import RequestUsage
from shotgun.agents.config.models import ModelConfig, ModelName, ProviderType
def _make_model_config(
name: str ... | response.usage) | assert_* | complex_expr | test/unit/agents/tools/web_search/test_usage_tracking.py | test_anthropic_web_search_tracks_usage | 65 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.models import GraphStatus
@pytest.mark.integration
@pytest.mark.asyncio
async def test_service_initialization(service: CodebaseService):
"""Test that CodebaseService initializes correctly."""
assert service is not | None | assert | none_literal | test/integration/codebase/test_codebase_service.py | test_service_initialization | 17 | null | |
shotgun-sh/shotgun | from unittest.mock import AsyncMock, patch
import pytest
from pydantic_ai.messages import ModelRequest, ModelResponse, TextPart, UserPromptPart
from typer.testing import CliRunner
from shotgun.agents.conversation import ConversationHistory, ConversationManager
from shotgun.cli.clear import app
runner = CliRunner()
... | result.stdout | assert | complex_expr | test/unit/cli/test_clear.py | test_clear_conversation_success | 44 | null | |
shotgun-sh/shotgun | import time
from pathlib import Path
from shotgun.logging_config import cleanup_old_log_files
def test_cleanup_old_log_files_with_fewer_than_max(tmp_path: Path) -> None:
"""Test that cleanup doesn't delete files when count is below max."""
# Create 5 log files
log_files = []
for i in range(5):
... | 5 | assert | numeric_literal | test/unit/test_logging_config.py | test_cleanup_old_log_files_with_fewer_than_max | 51 | null | |
shotgun-sh/shotgun | from datetime import datetime, timezone
import pytest
from shotgun.agents.config.models import MarketingConfig, MarketingMessageRecord
from shotgun.agents.models import FileOperation, FileOperationType
from shotgun.utils.marketing import (
GITHUB_STAR_MESSAGE_ID,
SPEC_FILES,
MarketingManager,
)
def test_... | True | assert | bool_literal | test/unit/test_marketing.py | test_should_show_github_star_message_not_shown_yet | 30 | null | |
shotgun-sh/shotgun | from __future__ import annotations
from pathlib import Path
import pytest
from shotgun.codebase.benchmarks import BenchmarkRunner
from .conftest import CPUSampler, MemorySampler, cleanup_database_for_path
@pytest.mark.slow
@pytest.mark.performance
@pytest.mark.asyncio
async def test_throughput_measurement(
med... | None | assert | none_literal | test/performance/codebase/test_parallel_performance.py | test_throughput_measurement | 288 | null | |
shotgun-sh/shotgun | import json
from datetime import datetime
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
TextPart,
ToolCallPart,
ToolReturnPart,
UserPromptPart,
)
from shotgun.agents.conversation import (
ConversationHistory,
ConversationManager,
ConversationState,
... | 2 | assert | numeric_literal | test/unit/test_conversation_history.py | test_conversation_history_with_agent_messages | 48 | null | |
shotgun-sh/shotgun | from shotgun.exceptions import IncompleteToolCallError, UserActionableError
def test_incomplete_tool_call_error_with_tool_name():
"""IncompleteToolCallError should include tool name when provided."""
error = IncompleteToolCallError(tool_name="web_search")
assert error.tool_name == "web_search"
assert ... | str(error) | assert | func_call | test/unit/exceptions/test_incomplete_tool_call.py | test_incomplete_tool_call_error_with_tool_name | 24 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import retrieve_code
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_retrieve_code_class_success(
indexed_graph: CodebaseGr... | 0 | assert | numeric_literal | test/integration/codebase/tools/test_retrieve_code.py | test_retrieve_code_class_success | 28 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.sdk.services import get_codebase_service
@pytest.mark.integration
@pytest.mark.asyncio
async def test_service_functionality(temp_storage_dir):
"""Test that returned service is functional."""
custom_dir = temp_storage_dir / "functional_test"
service = get_codebase_service(custom_... | [] | assert | collection | test/integration/sdk/test_sdk_services.py | test_service_functionality | 51 | null | |
shotgun-sh/shotgun | import os
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.agents.tools.web_search import (
get_available_web_search_tools,
is_provider_available,
)
@pytest.mark.asyncio
async def test_get_available_web_search_tools_returns_list():
"""Test that get_available_web_search_too... | 1 | assert | numeric_literal | test/integration/tools/web_search/test_web_search_availability.py | test_get_available_web_search_tools_returns_list | 20 | null | |
shotgun-sh/shotgun | from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai import Agent
from pydantic_ai.agent import AgentRunResult
from pydantic_ai.messages import ModelMessage
from shotgun.agents.models import AgentDeps, AgentRuntimeOptions
from shotgun.agents.plan import create_plan_agent, run_plan_agent
from shot... | [] | assert | collection | test/unit/agents/test_agent_creation.py | test_create_research_agent_no_web_tools | 274 | null | |
shotgun-sh/shotgun | import re
from datetime import datetime, timezone
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
import typer
from typer.testing import CliRunner
from shotgun.cli.spec.commands import _async_pull, app
from shotgun.shotgun_web.exceptions import (
ForbiddenError,
No... | typer.Exit) | pytest.raises | complex_expr | test/unit/cli/spec/test_commands.py | test_async_pull_unauthorized_error | 197 | null | |
shotgun-sh/shotgun | import asyncio
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from pydantic_ai import Agent
from pydantic_ai.agent import AgentRunResult
from pydantic_ai.messages import (
ModelMessage,
ModelRequest,
ModelResponse,
SystemPromptPart,
TextPart,
)
from sh... | [] | assert | collection | test/unit/agents/test_agent_manager.py | test_agent_manager_init | 154 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import directory_lister
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_directory_lister_root_directory(
indexed_graph: Cod... | True | assert | bool_literal | test/integration/codebase/tools/test_directory_lister.py | test_directory_lister_root_directory | 23 | null | |
shotgun-sh/shotgun | from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai import RunContext
from pydantic_ai.messages import (
BuiltinToolCallPart,
BuiltinToolReturnPart,
ModelRequest,
ModelResponse,
RetryPromptPart,
SystemPromptPart,
TextPart,
ThinkingPart,
ToolCallPart,
ToolRe... | 2 | assert | numeric_literal | test/unit/test_history_processors.py | test_extracts_context_from_various_message_types | TestTokenLimitCompactor | 253 | null |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import directory_lister
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_directory_lister_empty_directory_path(
indexed_grap... | "" | assert | string_literal | test/integration/codebase/tools/test_directory_lister.py | test_directory_lister_empty_directory_path | 285 | null | |
shotgun-sh/shotgun | import asyncio
import json
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from shotgun.agents.autopilot.claude_cli_subprocess import (
ClaudeCliSubprocess,
_format_team_tool,
)
from shotgun.agents.autopilot.claude_subprocess import ClaudeSubprocessConfig
from shotgun.agents.autopilot.mode... | "bar" | assert | string_literal | test/unit/agents/autopilot/test_claude_cli_subprocess.py | test_cli_subprocess_passes_env_vars | 91 | null | |
shotgun-sh/shotgun | from __future__ import annotations
from pathlib import Path
import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.models import GraphStatus, IndexProgress, ProgressPhase
@pytest.mark.integration
@pytest.mark.asyncio
async def test_sequential_mode_produces_results(
calculato... | 3 | assert | numeric_literal | test/integration/codebase/test_regression.py | test_sequential_mode_produces_results | 186 | null | |
shotgun-sh/shotgun | from __future__ import annotations
from pathlib import Path
import pytest
from shotgun.codebase.benchmarks import BenchmarkRunner
from .conftest import CPUSampler, MemorySampler, cleanup_database_for_path
@pytest.mark.slow
@pytest.mark.performance
@pytest.mark.asyncio
async def test_benchmark_runner_produces_valid... | 0 | assert | numeric_literal | test/performance/codebase/test_parallel_performance.py | test_benchmark_runner_produces_valid_metrics | 256 | null | |
shotgun-sh/shotgun | from shotgun.exceptions import (
AgentCancelledException,
BudgetExceededException,
BYOKAuthenticationException,
BYOKGenericAPIException,
BYOKQuotaBillingException,
BYOKRateLimitException,
BYOKServiceOverloadException,
ContextSizeLimitExceeded,
GenericAPIStatusException,
ShotgunRa... | plain | assert | variable | test/unit/agents/test_error_messages.py | test_byok_rate_limit | 85 | null | |
shotgun-sh/shotgun | import json
import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from pydantic import SecretStr
from shotgun.agents.config.constants import (
API_KEY_FIELD,
CONFIG_VERSION_FIELD,
SHOTGUN_INSTANCE_ID_FIELD,
ConfigSection,
)
from shotgun.agents.config.manager ... | 2 | assert | numeric_literal | test/unit/test_config_manager.py | test_load_config_not_exists | 70 | null | |
shotgun-sh/shotgun | from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from typer.testing import CliRunner
from shotgun.agents.models import AgentResponse
from shotgun.agents.router import RouterMode
from shotgun.cli.run import app
runner = CliRunner()
def mock_router_agent():
"""Create a mock router agent and dep... | result.stdout | assert | complex_expr | test/unit/cli/test_run.py | test_run_command_success | 58 | null | |
shotgun-sh/shotgun | import json
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from shotgun.agents.config.manager import (
CURRENT_CONFIG_VERSION,
ConfigManager,
_apply_migrations,
_migrate_v8_to_v9,
)
from shotgun.agents.models import AgentSystemPromptContext
V8_CONFIG... | True | assert | bool_literal | test/unit/test_context7.py | test_migrate_v8_to_v9_preserves_existing_fields | 62 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.agents.tools.codebase import ShellCommandResult, codebase_shell
@pytest.mark.asyncio
async def test_codebase_shell_success(
mock_run_context, mock_codebase_service, mock_graph, tmp_path
):
"""Test successful shell command execution."""
mock_graph.repo_path = str(tmp_path)
mo... | "ls" | assert | string_literal | test/unit/codebase/tools/test_codebase_shell.py | test_codebase_shell_success | 21 | null | |
shotgun-sh/shotgun | from __future__ import annotations
from pathlib import Path
import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.models import GraphStatus, IndexProgress, ProgressPhase
@pytest.mark.integration
@pytest.mark.asyncio
async def test_codebase_query_after_indexing(
simple_pytho... | 1 | assert | numeric_literal | test/integration/codebase/test_regression.py | test_codebase_query_after_indexing | 83 | null | |
shotgun-sh/shotgun | import pytest
from shotgun.codebase.models import CodebaseGraph, GraphStatus, QueryResult
from shotgun.sdk.models import (
DeleteResult,
ErrorResult,
IndexResult,
InfoResult,
ListResult,
QueryCommandResult,
ReindexResult,
)
@pytest.mark.integration
def test_list_result_with_graphs():
"... | output | assert | variable | test/integration/sdk/test_sdk_models.py | test_list_result_with_graphs | 53 | null | |
shotgun-sh/shotgun | from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai import RunContext
from pydantic_ai.messages import (
BuiltinToolCallPart,
BuiltinToolReturnPart,
ModelRequest,
ModelResponse,
RetryPromptPart,
SystemPromptPart,
TextPart,
ThinkingPart,
ToolCallPart,
ToolRe... | "" | assert | string_literal | test/unit/test_history_processors.py | test_system_prompt_returns_empty | TestGetContextFromMessage | 413 | null |
shotgun-sh/shotgun | import base64
from pathlib import Path
import pytest
from pydantic_ai.messages import DocumentUrl, ImageUrl
from shotgun.agents.config.models import ProviderType
from shotgun.attachments import (
parse_attachment_reference,
process_attachment,
)
from shotgun.attachments.models import AttachmentType
def sampl... | text | assert | variable | test/integration/test_attachment_flow.py | test_parse_png_attachment | 60 | null | |
shotgun-sh/shotgun | import base64
from pathlib import Path
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.attachments.models import AttachmentType, FileAttachment
from shotgun.attachments.processor import (
DEFAULT_SIZE_LIMIT,
PROVIDER_SIZE_LIMITS,
create_attachment_hint_display,
encode_... | "0 B" | assert | string_literal | test/unit/attachments/test_attachment_processor.py | test_format_file_size_bytes | 46 | null | |
shotgun-sh/shotgun | import pytest
from pydantic_ai import RunContext
from shotgun.agents.models import AgentDeps
from shotgun.agents.tools.codebase import directory_lister
from shotgun.codebase.models import CodebaseGraph
@pytest.mark.integration
@pytest.mark.asyncio
async def test_directory_lister_file_properties(
indexed_graph: Co... | 2 | assert | numeric_literal | test/integration/codebase/tools/test_directory_lister.py | test_directory_lister_file_properties | 393 | null | |
shotgun-sh/shotgun | import json
import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from pydantic import SecretStr
from shotgun.agents.config.constants import (
API_KEY_FIELD,
CONFIG_VERSION_FIELD,
SHOTGUN_INSTANCE_ID_FIELD,
ConfigSection,
)
from shotgun.agents.config.manager ... | 1 | assert | numeric_literal | test/unit/test_config_manager.py | test_save_config_without_argument | 207 | null | |
shotgun-sh/shotgun | import json
from datetime import datetime
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
TextPart,
ToolCallPart,
ToolReturnPart,
UserPromptPart,
)
from shotgun.agents.conversation import (
ConversationHistory,
ConversationManager,
ConversationState,
... | 3 | assert | numeric_literal | test/unit/test_conversation_history.py | test_conversation_history_ui_messages_with_hints | 251 | null | |
shotgun-sh/shotgun | import json
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from shotgun.agents.config.manager import (
CURRENT_CONFIG_VERSION,
ConfigManager,
_apply_migrations,
_migrate_v8_to_v9,
)
from shotgun.agents.models import AgentSystemPromptContext
V8_CONFIG... | None | assert | none_literal | test/unit/test_context7.py | test_update_context7_sets_key | 112 | null | |
shotgun-sh/shotgun | from shotgun.exceptions import IncompleteToolCallError, UserActionableError
def test_incomplete_tool_call_error_plain_text_with_tool_name():
"""to_plain_text should include tool name when provided."""
error = IncompleteToolCallError(tool_name="web_search")
text = error.to_plain_text()
assert "web_sear... | text | assert | variable | test/unit/exceptions/test_incomplete_tool_call.py | test_incomplete_tool_call_error_plain_text_with_tool_name | 48 | null | |
shotgun-sh/shotgun | from __future__ import annotations
from pathlib import Path
import pytest
from shotgun.codebase import CodebaseService, QueryType
from shotgun.codebase.models import GraphStatus, IndexProgress, ProgressPhase
@pytest.mark.integration
@pytest.mark.asyncio
async def test_codebase_query_after_indexing(
simple_pytho... | True | assert | bool_literal | test/integration/codebase/test_regression.py | test_codebase_query_after_indexing | 82 | null | |
shotgun-sh/shotgun | from __future__ import annotations
import pytest
from shotgun.codebase.core.extractors.javascript.extractor import JavaScriptExtractor
from shotgun.codebase.core.extractors.types import SupportedLanguage
from shotgun.codebase.core.extractors.typescript.extractor import TypeScriptExtractor
from shotgun.codebase.core.p... | "obj" | assert | string_literal | test/unit/codebase/extractors/test_typescript_extractor.py | test_parse_method_call | 71 | null | |
shotgun-sh/shotgun | import os
import pytest
from shotgun.agents.config.models import ProviderType
from shotgun.agents.tools.web_search import (
gemini_web_search_tool,
is_provider_available,
)
@pytest.mark.asyncio
@pytest.mark.skipif(
not os.getenv("GEMINI_API_KEY"),
reason="Gemini API key not set",
)
async def test_gem... | 0 | assert | numeric_literal | test/integration/tools/web_search/test_gemini_search.py | test_gemini_web_search_smoke | 30 | null | |
shotgun-sh/shotgun | from __future__ import annotations
import pytest
from shotgun.codebase.core.extractors.javascript.extractor import JavaScriptExtractor
from shotgun.codebase.core.extractors.types import SupportedLanguage
from shotgun.codebase.core.extractors.typescript.extractor import TypeScriptExtractor
from shotgun.codebase.core.p... | types | assert | variable | test/unit/codebase/extractors/test_typescript_extractor.py | test_class_definition_types_include_typescript_specific | 41 | null | |
shotgun-sh/shotgun | import json
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from shotgun.agents.config.manager import (
CURRENT_CONFIG_VERSION,
ConfigManager,
_apply_migrations,
_migrate_v8_to_v9,
)
from shotgun.agents.models import AgentSystemPromptContext
V8_CONFIG... | {} | assert | collection | test/unit/test_context7.py | test_migrate_v8_to_v9 | 45 | null | |
shotgun-sh/shotgun | import tempfile
from pathlib import Path
import pytest
from shotgun.codebase.core.metrics_types import (
FileInfo,
FileParseTask,
WorkBatch,
)
from shotgun.codebase.core.parallel_executor import ParallelExecutor
from shotgun.codebase.core.work_distributor import WorkDistributor
from shotgun.codebase.core.... | lookup | assert | variable | test/integration/codebase/test_parallel_correctness.py | test_parallel_builds_function_registry | 217 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.