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 |
|---|---|---|---|---|---|---|---|---|---|
mpfaffenberger/code_puppy | from __future__ import annotations
import time
import pytest
from code_puppy.plugins.antigravity_oauth.accounts import (
AccountManager,
ManagedAccount,
_clear_expired_rate_limits,
_get_quota_key,
_is_rate_limited_for_family,
_is_rate_limited_for_quota_key,
_now_ms,
)
from code_puppy.plug... | i | assert | variable | tests/plugins/test_antigravity_accounts.py | test_init_from_storage_with_accounts | TestAccountManagerInitialization | 261 | null |
mpfaffenberger/code_puppy | import json
import pickle
from unittest.mock import MagicMock, patch
import pytest
from httpx import ASGITransport, AsyncClient
from code_puppy.api.app import create_app
from code_puppy.api.routers.sessions import _serialize_message
def sessions_dir(tmp_path):
"""Create a temporary sessions directory with test d... | ids | assert | variable | tests/api/test_sessions_router.py | test_list_sessions | 57 | null | |
mpfaffenberger/code_puppy | import pytest
from code_puppy.command_line.command_registry import (
CommandInfo,
clear_registry,
get_all_commands,
get_command,
get_unique_commands,
register_command,
)
class TestClearRegistry:
def test_clear_registry_with_commands(self):
"""Test clearing registry with commands r... | 0 | assert | numeric_literal | tests/test_command_registry.py | test_clear_registry_with_commands | TestClearRegistry | 407 | null |
mpfaffenberger/code_puppy | import sys
import time
from unittest.mock import MagicMock, patch
import pytest
from rich.console import Console
from rich.text import Text
def mock_spinner_registration():
"""Mock spinner registration for all tests."""
with (
patch("code_puppy.messaging.spinner.register_spinner"),
patch("code... | 0 | assert | numeric_literal | tests/test_console_spinner_coverage.py | test_update_frame_wraps_around | TestConsoleSpinnerUpdateFrame | 343 | null |
mpfaffenberger/code_puppy | import os
import tempfile
import threading
import time
import uuid
from contextlib import asynccontextmanager
from unittest.mock import AsyncMock, Mock, patch
import pytest
from code_puppy.mcp_.blocking_startup import (
BlockingMCPServerStdio,
SimpleCapturedMCPServerStdio,
StartupMonitor,
StderrFileCa... | "" | assert | string_literal | tests/mcp/test_blocking_startup_coverage.py | test_monitor_file_skips_empty_lines | TestStderrFileCaptureMonitoring | 144 | null |
mpfaffenberger/code_puppy | import copy
import json
from pathlib import Path
from typing import Any, Dict
from unittest.mock import MagicMock, patch
import pytest
SAMPLE_CONFIG: Dict[str, Any] = {
"PreToolUse": [
{
"matcher": "Bash || agent_run_shell_command",
"hooks": [
{
... | 0 | assert | numeric_literal | tests/test_hook_manager.py | test_render_list_returns_list | TestHooksMenuDataMethods | 436 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.plugins.chatgpt_oauth import config, utils
def test_remove_chatgpt_models(tmp_path):
"""Test removal of ChatGPT models from config."""
with patch.object(
config, "get_chatgpt_models_path", return_value=tmp_path / "ch... | 1 | assert | numeric_literal | code_puppy/plugins/chatgpt_oauth/test_plugin.py | test_remove_chatgpt_models | 207 | null | |
mpfaffenberger/code_puppy | from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy.mcp_.mcp_logs import (
MAX_LOG_SIZE,
clear_logs,
get_log_stats,
get_mcp_logs_dir,
list_servers_with_logs,
read_logs,
rotate_log_if_needed,
write_log,
)
def temp_logs_dir(tmp_path):
"""Create a t... | logs[2] | assert | complex_expr | tests/mcp/test_mcp_logs.py | test_read_logs_with_limit | TestMCPLogs | 100 | null |
mpfaffenberger/code_puppy | import os
import pytest
from rich.table import Table
from code_puppy.command_line.utils import list_directory, make_directory_table
class TestMakeDirectoryTable:
def test_make_directory_table_has_title(self, tmp_path):
"""Test that table has a formatted title."""
table = make_directory_table(str... | None | assert | none_literal | tests/test_command_line_utils.py | test_make_directory_table_has_title | TestMakeDirectoryTable | 183 | null |
mpfaffenberger/code_puppy | import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
class TestModelValidation:
def test_model_string_strip(self):
"""Test that model names with whitespace are trimmed."""
model_name = " gpt-5 "
trimmed = model_name.strip()
assert trimmed == "gpt-5"
... | 1 | assert | numeric_literal | tests/test_cli_runner.py | test_model_string_strip | TestModelValidation | 124 | null |
mpfaffenberger/code_puppy | from code_puppy.plugins.shell_safety.command_cache import (
CachedAssessment,
CommandSafetyCache,
cache_assessment,
get_cached_assessment,
)
class TestCacheFunctions:
def test_cache_stats(self):
"""Should track hits and misses."""
cache = CommandSafetyCache(max_size=10)
cac... | 1 | assert | numeric_literal | tests/test_command_cache.py | test_cache_stats | TestCacheFunctions | 83 | null |
mpfaffenberger/code_puppy | import time
from io import StringIO
from unittest.mock import MagicMock, patch
import pytest
from rich.console import Console
from code_puppy.messaging.spinner.console_spinner import ConsoleSpinner
def console():
return Console(file=StringIO(), force_terminal=False, width=120)
def reset_user_input():
"""Ens... | "" | assert | string_literal | tests/messaging/spinner/test_console_spinner.py | test_generate_spinner_panel_paused | 86 | null | |
mpfaffenberger/code_puppy | import time
from io import StringIO
from unittest.mock import MagicMock, patch
import pytest
from rich.console import Console
from code_puppy.messaging.spinner.console_spinner import ConsoleSpinner
def console():
return Console(file=StringIO(), force_terminal=False, width=120)
def reset_user_input():
"""Ens... | str(panel) | assert | func_call | tests/messaging/spinner/test_console_spinner.py | test_generate_spinner_panel_with_context | 96 | null | |
mpfaffenberger/code_puppy | from unittest.mock import MagicMock, patch
from code_puppy.agents.agent_creator_agent import AgentCreatorAgent
class TestAgentCreatorAgent:
def test_validate_agent_json_valid(self):
agent = AgentCreatorAgent()
config = {
"name": "test-agent",
"description": "Test",
... | [] | assert | collection | tests/test_agent_creator_full_coverage.py | test_validate_agent_json_valid | TestAgentCreatorAgent | 100 | null |
mpfaffenberger/code_puppy | import json
from datetime import datetime
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
SystemPromptPart,
TextPart,
ToolCallPart,
ToolReturnPart,
UserPromptPart,
)
from pydantic_ai.models impo... | 5 | assert | numeric_literal | tests/test_gemini_code_assist.py | test_parse_response_text | TestGeminiCodeAssistModel | 235 | null |
mpfaffenberger/code_puppy | import os
import sys
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.document import Document
from prompt_toolkit.formatted_text import FormattedText
from prompt_toolkit.keys import Keys
from prompt_toolkit.layout... | "" | assert | string_literal | tests/test_prompt_toolkit_completion.py | test_set_completer_on_set_trigger | 161 | null | |
mpfaffenberger/code_puppy | from __future__ import annotations
import time
import pytest
from .accounts import AccountManager
from .config import ANTIGRAVITY_OAUTH_CONFIG
from .constants import ANTIGRAVITY_MODELS, ANTIGRAVITY_SCOPES
from .oauth import (
_compute_code_challenge,
_decode_state,
_encode_state,
_generate_code_verif... | c2 | assert | variable | code_puppy/plugins/antigravity_oauth/test_plugin.py | test_different_verifiers_produce_different_challenges | TestPKCE | 54 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from pydantic_ai import BinaryContent
from code_puppy.cli_runner import run_prompt_with_attachments
from code_puppy.command_line.attachments import (
DEFAULT_ACCEPTED_IMAGE_EXTENSIONS,
parse_p... | [] | assert | collection | tests/test_command_line_attachments.py | test_parse_prompt_attachments_handles_images | 30 | null | |
mpfaffenberger/code_puppy | import configparser
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy import callbacks, session_storage
from code_puppy import config as cp_config
def mock_config_paths(monkeypatch, tmp_path):
"""Mock XDG paths for isolated testing."""
mock_config_dir = str(tmp_... | 0 | assert | numeric_literal | tests/test_config_and_storage_edge_cases.py | test_unregister_callback_returns_true_when_successful | TestCallbacksErrorHandling | 364 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
import base64
import json
import time
from unittest.mock import MagicMock, patch
import pytest
import requests
from code_puppy.plugins.antigravity_oauth.oauth import (
AntigravityStatus,
OAuthContext,
TokenExchangeFailure,
TokenExchangeSuccess,
_compute_code_cha... | "" | assert | string_literal | tests/plugins/test_antigravity_oauth.py | test_decode_state_empty_project | TestStateHandling | 168 | null |
mpfaffenberger/code_puppy | import configparser
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy import callbacks, session_storage
from code_puppy import config as cp_config
def mock_config_paths(monkeypatch, tmp_path):
"""Mock XDG paths for isolated testing."""
mock_config_dir = str(tmp_... | [] | assert | collection | tests/test_config_and_storage_edge_cases.py | test_list_sessions_returns_empty_for_nonexistent_dir | TestSessionListingAndCleanup | 550 | null |
mpfaffenberger/code_puppy | import os
from unittest.mock import MagicMock, patch
MODULE = "code_puppy.command_line.mcp.catalog_server_installer"
UTILS = "code_puppy.command_line.mcp.utils"
class TestGetEnvVarHint:
def test_unknown_var(self):
from code_puppy.command_line.mcp.catalog_server_installer import (
get_env_var_... | "" | assert | string_literal | tests/command_line/mcp/test_catalog_server_installer.py | test_unknown_var | TestGetEnvVarHint | 69 | null |
mpfaffenberger/code_puppy | import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
class TestArgumentParsing:
def test_interactive_flag_short(self):
"""Test -i flag for interactive mode."""
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--interactive", a... | True | assert | bool_literal | tests/test_cli_runner.py | test_interactive_flag_short | TestArgumentParsing | 64 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.plugins.chatgpt_oauth import config, utils
def test_code_challenge_computation():
"""Test PKCE code challenge computation."""
verifier = "test_verifier_string"
challenge = utils._compute_code_challenge(verifier)
asse... | 0 | assert | numeric_literal | code_puppy/plugins/chatgpt_oauth/test_plugin.py | test_code_challenge_computation | 90 | null | |
mpfaffenberger/code_puppy | import os
from unittest.mock import patch
from code_puppy.http_utils import ProxyConfig
class TestFindAvailablePort:
def test_find_available_port_returns_int(self):
"""Test find_available_port returns an integer."""
from code_puppy.http_utils import find_available_port
port = find_availa... | 0 | assert | numeric_literal | tests/test_http_utils.py | test_find_available_port_returns_int | TestFindAvailablePort | 348 | null |
mpfaffenberger/code_puppy | import asyncio
import time
from io import StringIO
from unittest.mock import MagicMock, patch
import pytest
from rich.console import Console
from code_puppy.messaging.bus import MessageBus
from code_puppy.messaging.messages import (
AgentReasoningMessage,
AgentResponseMessage,
ConfirmationRequest,
Dif... | "" | assert | string_literal | tests/messaging/test_rich_renderer.py | test_render_file_listing_suppressed | 191 | null | |
mpfaffenberger/code_puppy | import configparser
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy import callbacks, session_storage
from code_puppy import config as cp_config
def mock_config_paths(monkeypatch, tmp_path):
"""Mock XDG paths for isolated testing."""
mock_config_dir = str(tmp_... | True | assert | bool_literal | tests/test_config_and_storage_edge_cases.py | test_get_use_dbos_returns_true_by_default | TestDBOSConfiguration | 55 | null |
mpfaffenberger/code_puppy | from types import SimpleNamespace
from unittest.mock import MagicMock, patch
from code_puppy.command_line.command_handler import handle_command
from code_puppy.command_line.command_registry import get_command
def setup_messaging_mocks():
"""Set up mocks for all the messaging functions and return them in a diction... | True | assert | bool_literal | tests/test_command_handler.py | test_help_outputs_help | 33 | null | |
mpfaffenberger/code_puppy | import uuid
from datetime import datetime
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
RetryPromptPart,
SystemPromptPart,
TextPart,
ThinkingPart,
ToolCallPart,
ToolReturnPart,
UserPro... | 2 | assert | numeric_literal | tests/test_gemini_model_full_coverage.py | test_merge_consecutive_user_messages | TestMapMessages | 438 | null |
mpfaffenberger/code_puppy | import os
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import MagicMock, patch
import pytest
from code_puppy import config as cp_config
from code_puppy.session_storage import SessionMetadata
def mock_config_paths(monkeypatch):
mock_home = "/mock_home"
mock_config_dir = os.pat... | True | assert | bool_literal | tests/test_auto_save_session.py | test_get_auto_save_session_default_true | TestAutoSaveSession | 69 | null |
mpfaffenberger/code_puppy | import json
from datetime import datetime
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
SystemPromptPart,
TextPart,
ToolCallPart,
ToolReturnPart,
UserPromptPart,
)
from pydantic_ai.models impo... | 2 | assert | numeric_literal | tests/test_gemini_code_assist.py | test_build_request_system_prompt | TestGeminiCodeAssistModel | 76 | null |
mpfaffenberger/code_puppy | import json
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai.messages import ModelRequest, ModelResponse, TextPart
from code_puppy.tools.agent_tools import (
_generate_session_hash_suffix,
_load_session_history,
_save_session_history,
_... | [] | assert | collection | tests/test_agent_tools.py | test_load_nonexistent_session_returns_empty_list | TestSessionSaveLoad | 294 | null |
mpfaffenberger/code_puppy | from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from pydantic_ai import ToolReturn
from code_puppy.tools.browser.terminal_command_tools import (
_focus_terminal,
_normalize_modifier,
register_run_terminal_command,
register_send_terminal_keys,
register_wait_terminal_output,
... | r | assert | variable | tests/tools/browser/test_terminal_command_tools_full.py | test_with_screenshot_tool_return | TestRunTerminalCommand | 135 | null |
mpfaffenberger/code_puppy | import configparser
import json
import os
import pathlib
from unittest.mock import MagicMock, patch
import pytest
from code_puppy import config as cp_config
class TestNumericGetters:
def test_get_diff_context_lines_default(self):
cp_config.reset_value("diff_context_lines")
assert cp_config.get_... | 6 | assert | numeric_literal | tests/test_config_full_coverage.py | test_get_diff_context_lines_default | TestNumericGetters | 235 | null |
mpfaffenberger/code_puppy | from unittest.mock import patch
import pytest
from httpx import ASGITransport, AsyncClient
from code_puppy.api.app import create_app
def mock_config():
with (
patch(
"code_puppy.api.routers.config.get_config_keys", create=True
) as mock_keys,
patch("code_puppy.api.routers.conf... | resp.json() | assert | func_call | tests/api/test_config_router.py | test_get_config_keys | 55 | null | |
mpfaffenberger/code_puppy | import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
class TestArgumentParsing:
def test_version_flag(self):
"""Test --version flag displays version."""
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"--version",
... | 0 | assert | numeric_literal | tests/test_cli_runner.py | test_version_flag | TestArgumentParsing | 37 | null |
mpfaffenberger/code_puppy | import os
from unittest.mock import patch
from code_puppy.http_utils import ProxyConfig
class TestProxyConfigClass:
def test_proxy_config_creation(self):
"""Test creating a ProxyConfig instance."""
config = ProxyConfig(
verify=True,
trust_env=False,
proxy_url=N... | True | assert | bool_literal | tests/test_http_utils.py | test_proxy_config_creation | TestProxyConfigClass | 30 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from pydantic_ai import BinaryContent
from code_puppy.cli_runner import run_prompt_with_attachments
from code_puppy.command_line.attachments import (
DEFAULT_ACCEPTED_IMAGE_EXTENSIONS,
parse_p... | 1 | assert | numeric_literal | tests/test_command_line_attachments.py | test_parse_prompt_attachments_handles_unquoted_spaces | 42 | null | |
mpfaffenberger/code_puppy | import asyncio
import queue
import threading
from unittest.mock import patch
import pytest
from code_puppy.messaging.bus import MessageBus
from code_puppy.messaging.commands import (
ConfirmationResponse,
SelectionResponse,
UserInputResponse,
)
from code_puppy.messaging.messages import (
MessageCatego... | True | assert | bool_literal | tests/test_messaging_bus.py | test_request_confirmation_yes | TestConfirmationRequest | 330 | null |
mpfaffenberger/code_puppy | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
from prompt_toolkit.document import Document
class TestModelSwitching:
def test_get_effective_agent_model_exception(self):
from code_puppy.model_switching import _get_effective_agent_model
agent = Magic... | None | assert | none_literal | tests/test_completions_and_small_modules.py | test_get_effective_agent_model_exception | TestModelSwitching | 393 | null |
mpfaffenberger/code_puppy | import os
from unittest.mock import patch
class TestModelConfigStructure:
def test_openai_o1_config(self):
"""Test OpenAI O1 model config structure."""
config = {
"o1": {
"type": "openai",
"name": "o1",
"supports_vision": False,
... | True | assert | bool_literal | tests/test_model_factory_providers.py | test_openai_o1_config | TestModelConfigStructure | 130 | null |
mpfaffenberger/code_puppy | from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy.mcp_.mcp_logs import (
MAX_LOG_SIZE,
clear_logs,
get_log_stats,
get_mcp_logs_dir,
list_servers_with_logs,
read_logs,
rotate_log_if_needed,
write_log,
)
def temp_logs_dir(tmp_path):
"""Create a t... | logs[1] | assert | complex_expr | tests/mcp/test_mcp_logs.py | test_write_and_read_logs | TestMCPLogs | 82 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from unittest.mock import MagicMock, patch
import pytest
_REVIEWER_AGENTS = [
("code_puppy.agents.agent_c_reviewer", "CReviewerAgent"),
("code_puppy.agents.agent_code_reviewer", "CodeQualityReviewerAgent"),
("code_puppy.... | 0 | assert | numeric_literal | tests/test_coverage_agents_gaps.py | test_reviewer_agent_tools_and_prompt | 44 | null | |
mpfaffenberger/code_puppy | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from unittest.mock import MagicMock, patch
import pytest
_REVIEWER_AGENTS = [
("code_puppy.agents.agent_c_reviewer", "CReviewerAgent"),
("code_puppy.agents.agent_code_reviewer", "CodeQualityReviewerAgent"),
("code_puppy.... | "" | assert | string_literal | tests/test_coverage_agents_gaps.py | test_clear_context_info | TestSpinnerBaseGaps | 268 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import AsyncMock, Mock, patch
import httpx
import pytest
from code_puppy.plugins.antigravity_oauth.transport import (
AntigravityClient,
UnwrappedResponse,
UnwrappedSSEResponse,
_inline_refs,
create_antigravity_client,
)
class TestAntigravityClientWrapRequest:
... | "" | assert | string_literal | tests/plugins/test_antigravity_transport.py | test_wrap_request_regular_url_transformation | TestAntigravityClientWrapRequest | 708 | null |
mpfaffenberger/code_puppy | import asyncio
from unittest.mock import patch
import pytest
from code_puppy.callbacks import (
clear_callbacks,
count_callbacks,
get_callbacks,
on_custom_command,
on_edit_file,
on_load_model_config,
on_post_tool_call,
on_pre_tool_call,
on_startup,
on_stream_event,
register... | 0 | assert | numeric_literal | tests/test_callbacks_extended.py | test_unregister_callback | TestCallbacksExtended | 93 | null |
mpfaffenberger/code_puppy | import os
import pytest
from rich.table import Table
from code_puppy.command_line.utils import list_directory, make_directory_table
class TestListDirectory:
def test_list_directory_with_mixed_content(self, tmp_path):
"""Test listing directory with various file types and directories."""
# Create ... | 2 | assert | numeric_literal | tests/test_command_line_utils.py | test_list_directory_with_mixed_content | TestListDirectory | 105 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import MagicMock, patch
import pytest
def _test_reviewer_agent(module_path, class_name):
"""Helper to test reviewer agents' tools and prompt methods."""
import importlib
mod = importlib.import_module(module_path)
cls = getattr(mod, class_name)
agent = cls()
tool... | msg | assert | variable | tests/agents/test_agents_remaining_coverage.py | test_creator_create_agent_json_validation_error | 470 | null | |
mpfaffenberger/code_puppy | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
from prompt_toolkit.document import Document
class TestMarkdownPatches:
def test_left_justified_heading_h1(self):
import io
from rich.console import Console
from rich.text import Text
f... | 0 | assert | numeric_literal | tests/test_completions_and_small_modules.py | test_left_justified_heading_h1 | TestMarkdownPatches | 472 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import AsyncMock, Mock, patch
import httpx
import pytest
from code_puppy.chatgpt_codex_client import (
ChatGPTCodexAsyncClient,
_is_reasoning_model,
create_codex_async_client,
)
class TestIsReasoningModel:
def test_gpt5_is_reasoning_model(self):
"""Test that GP... | True | assert | bool_literal | tests/test_chatgpt_codex_client.py | test_gpt5_is_reasoning_model | TestIsReasoningModel | 26 | null |
mpfaffenberger/code_puppy | import os
import tempfile
import pytest
from code_puppy.agents.agent_code_puppy import CodePuppyAgent
from code_puppy.config import (
clear_agent_pinned_model,
get_agent_pinned_model,
get_agents_pinned_to_model,
get_all_agent_pinned_models,
get_global_model_name,
set_agent_pinned_model,
)
def... | [] | assert | collection | tests/test_agent_pinned_models.py | test_get_agents_pinned_to_model_none | TestAgentPinnedModels | 154 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
import threading
import time
from http.server import HTTPServer
from unittest.mock import MagicMock, patch
import pytest
class TestAntigravityOAuthHelpers:
def test_decode_state_non_string_project(self):
"""Test _decode_state when projectId is not a string."""
... | "" | assert | string_literal | tests/plugins/test_antigravity_callbacks_coverage.py | test_decode_state_non_string_project | TestAntigravityOAuthHelpers | 1,425 | null |
mpfaffenberger/code_puppy | import asyncio
from unittest.mock import patch
import pytest
from code_puppy.callbacks import (
clear_callbacks,
count_callbacks,
get_callbacks,
on_custom_command,
on_edit_file,
on_load_model_config,
on_post_tool_call,
on_pre_tool_call,
on_startup,
on_stream_event,
register... | 3 | assert | numeric_literal | tests/test_callbacks_extended.py | test_register_multiple_callbacks | TestCallbacksExtended | 65 | null |
mpfaffenberger/code_puppy | import configparser
import json
import os
import pathlib
from unittest.mock import MagicMock, patch
import pytest
from code_puppy import config as cp_config
class TestAPIKeys:
def test_get_api_key_not_set(self):
assert cp_config.get_api_key("NONEXISTENT_KEY_XYZ") == | "" | assert | string_literal | tests/test_config_full_coverage.py | test_get_api_key_not_set | TestAPIKeys | 1,046 | null |
mpfaffenberger/code_puppy | import uuid
from datetime import datetime
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
RetryPromptPart,
SystemPromptPart,
TextPart,
ThinkingPart,
ToolCallPart,
ToolReturnPart,
UserPro... | "" | assert | string_literal | tests/test_gemini_model_full_coverage.py | test_no_candidates | TestParseResponse | 649 | null |
mpfaffenberger/code_puppy | from unittest.mock import MagicMock, patch
from code_puppy.agents.agent_creator_agent import AgentCreatorAgent
class TestAgentCreatorAgent:
def test_create_agent_json_validation_error(self):
agent = AgentCreatorAgent()
success, msg = agent.create_agent_json({})
assert success is False
... | msg | assert | variable | tests/test_agent_creator_full_coverage.py | test_create_agent_json_validation_error | TestAgentCreatorAgent | 216 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.plugins.chatgpt_oauth import config, utils
def test_prepare_oauth_context():
"""Test OAuth context preparation."""
context = utils.prepare_oauth_context()
assert context.state
assert context.code_verifier
assert ... | None | assert | none_literal | code_puppy/plugins/chatgpt_oauth/test_plugin.py | test_prepare_oauth_context | 105 | null | |
mpfaffenberger/code_puppy | import base64
import json
import time
from unittest.mock import AsyncMock, MagicMock, Mock, patch
import httpx
import pytest
from code_puppy.claude_cache_client import (
CLAUDE_CLI_USER_AGENT,
TOKEN_MAX_AGE_SECONDS,
TOOL_PREFIX,
ClaudeCacheAsyncClient,
_inject_cache_control_in_payload,
patch_a... | 0 | assert | numeric_literal | tests/test_claude_cache_client_full_coverage.py | test_exp_negative_age | TestJWTAge | 76 | null |
mpfaffenberger/code_puppy | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
from prompt_toolkit.document import Document
class TestMarkdownPatches:
def test_left_justified_heading_h2(self):
import io
from rich.console import Console
from rich.text import Text
f... | 2 | assert | numeric_literal | tests/test_completions_and_small_modules.py | test_left_justified_heading_h2 | TestMarkdownPatches | 488 | null |
mpfaffenberger/code_puppy | import configparser
import json
import os
import pathlib
from unittest.mock import MagicMock, patch
import pytest
from code_puppy import config as cp_config
class TestPerModelSettings:
def test_clear_model_settings(self):
cp_config.set_model_setting("clear-test", "temperature", 0.5)
cp_config.cl... | 0 | assert | numeric_literal | tests/test_config_full_coverage.py | test_clear_model_settings | TestPerModelSettings | 405 | null |
mpfaffenberger/code_puppy | import uuid
from datetime import datetime
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
RetryPromptPart,
SystemPromptPart,
TextPart,
ThinkingPart,
ToolCallPart,
ToolReturnPart,
UserPro... | c2 | assert | variable | tests/test_gemini_model_full_coverage.py | test_get_client_reuses | TestClientManagement | 316 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
from pathlib import Path
from unittest.mock import AsyncMock, patch
import pytest
from pydantic_ai import BinaryContent
from code_puppy.cli_runner import run_prompt_with_attachments
from code_puppy.command_line.attachments import (
DEFAULT_ACCEPTED_IMAGE_EXTENSIONS,
parse_p... | raw | assert | variable | tests/test_command_line_attachments.py | test_parse_prompt_does_not_parse_urls_anymore | 184 | null | |
mpfaffenberger/code_puppy | from unittest.mock import MagicMock, patch
from rich.text import Text
from code_puppy.command_line.mcp.utils import (
find_server_id_by_name,
format_state_indicator,
format_uptime,
suggest_similar_servers,
)
from code_puppy.mcp_.managed_server import ServerState
class TestSuggestSimilarServers:
... | args[0] | assert | complex_expr | tests/command_line/mcp/test_mcp_utils.py | test_no_servers_registered | TestSuggestSimilarServers | 233 | null |
mpfaffenberger/code_puppy | import os
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
class TestArgumentParsing:
def test_default_no_flags(self):
"""Test default behavior with no flags (interactive)."""
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--promp... | None | assert | none_literal | tests/test_cli_runner.py | test_default_no_flags | TestArgumentParsing | 101 | null |
mpfaffenberger/code_puppy | from code_puppy.plugins.shell_safety.command_cache import (
CachedAssessment,
CommandSafetyCache,
cache_assessment,
get_cached_assessment,
)
class TestCacheFunctions:
def test_cache_clear(self):
"""Should clear all entries and reset stats."""
cache = CommandSafetyCache(max_size=10)... | 0 | assert | numeric_literal | tests/test_command_cache.py | test_cache_clear | TestCacheFunctions | 95 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
import time
import pytest
from .accounts import AccountManager
from .config import ANTIGRAVITY_OAUTH_CONFIG
from .constants import ANTIGRAVITY_MODELS, ANTIGRAVITY_SCOPES
from .oauth import (
_compute_code_challenge,
_decode_state,
_encode_state,
_generate_code_verif... | "" | assert | string_literal | code_puppy/plugins/antigravity_oauth/test_plugin.py | test_encode_without_project_id | TestStateEncoding | 86 | null |
mpfaffenberger/code_puppy | from unittest.mock import patch
import pytest
from code_puppy.keymap import (
DEFAULT_CANCEL_AGENT_KEY,
KEY_CODES,
VALID_CANCEL_KEYS,
KeymapError,
cancel_agent_uses_signal,
get_cancel_agent_char_code,
get_cancel_agent_display_name,
get_cancel_agent_key,
validate_cancel_agent_key,
)... | True | assert | bool_literal | tests/test_keymap_coverage.py | test_returns_true_for_ctrl_c | TestCancelAgentUsesSignal | 172 | null |
mpfaffenberger/code_puppy | import configparser
import os
import tempfile
from unittest.mock import patch
import pytest
from code_puppy.config import (
DEFAULT_SECTION,
get_allow_recursion,
get_auto_save_session,
get_compaction_threshold,
get_diff_context_lines,
get_global_model_name,
get_message_limit,
get_owner... | "" | assert | string_literal | tests/test_config_extended_part1.py | test_set_value_empty_string | TestConfigExtendedPart1 | 105 | null |
mpfaffenberger/code_puppy | import sys
import time
from unittest.mock import MagicMock, patch
import pytest
from rich.console import Console
from rich.text import Text
def mock_spinner_registration():
"""Mock spinner registration for all tests."""
with (
patch("code_puppy.messaging.spinner.register_spinner"),
patch("code... | "" | assert | string_literal | tests/test_console_spinner_coverage.py | test_generate_panel_when_paused_returns_empty | TestConsoleSpinnerGeneratePanel | 362 | null |
mpfaffenberger/code_puppy | import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.tools.agent_tools import (
AgentInfo,
AgentInvokeOutput,
ListAgentsOutput,
_generate_dbos_workflow_id,
_get_subagent_sessions_dir,
register_invoke_agent,
register_list_agents,
... | 2 | assert | numeric_literal | tests/test_agent_tools_coverage.py | test_list_agents_returns_available_agents | TestRegisterListAgentsExecution | 310 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
from datetime import datetime
from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
TextPart,
ThinkingPart,
UserPromptPart,
)
from pydantic_ai.models import ModelRequestParameters
from pydantic_ai... | "" | assert | string_literal | tests/plugins/test_antigravity_model_request.py | test_request_empty_response | TestRequestMethod | 253 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import patch
import pytest
from code_puppy.tools.agent_tools import (
AgentInfo,
AgentInvokeOutput,
ListAgentsOutput,
_generate_dbos_workflow_id,
_generate_session_hash_suffix,
_get_subagent_sessions_dir,
_load_session_history,
_save_session_history,
... | None | assert | none_literal | tests/test_agent_tools_full_coverage.py | test_list_agents_output | TestModels | 141 | null |
mpfaffenberger/code_puppy | from unittest.mock import mock_open, patch
import pytest
from code_puppy.config import (
clear_agent_pinned_model,
get_agent_pinned_model,
get_compaction_strategy,
get_compaction_threshold,
get_use_dbos,
load_mcp_server_configs,
set_agent_pinned_model,
)
class TestConfigExtendedPart2:
... | True | assert | bool_literal | tests/test_config_extended_part2.py | test_get_use_dbos | TestConfigExtendedPart2 | 118 | null |
mpfaffenberger/code_puppy | from unittest.mock import mock_open, patch
import pytest
from code_puppy.config import (
clear_agent_pinned_model,
get_agent_pinned_model,
get_compaction_strategy,
get_compaction_threshold,
get_use_dbos,
load_mcp_server_configs,
set_agent_pinned_model,
)
class TestConfigExtendedPart2:
... | {} | assert | collection | tests/test_config_extended_part2.py | test_load_mcp_server_configs | TestConfigExtendedPart2 | 166 | null |
mpfaffenberger/code_puppy | import configparser
import os
from unittest.mock import MagicMock, mock_open, patch
import pytest
from code_puppy import config as cp_config
CONFIG_DIR_NAME = ".code_puppy"
CONFIG_FILE_NAME = "puppy.cfg"
DEFAULT_SECTION_NAME = "puppy"
def mock_config_paths(monkeypatch):
# Ensure that tests don't interact with t... | 2 | assert | numeric_literal | tests/test_config.py | test_initialize_command_history_file_creates_new_file | TestCommandHistory | 572 | null |
mpfaffenberger/code_puppy | import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.tools.agent_tools import (
AgentInfo,
AgentInvokeOutput,
ListAgentsOutput,
_generate_dbos_workflow_id,
_get_subagent_sessions_dir,
register_invoke_agent,
register_list_agents,
... | 0 | assert | numeric_literal | tests/test_agent_tools_coverage.py | test_create_with_error | TestListAgentsOutput | 198 | null |
mpfaffenberger/code_puppy | import os
import signal
from datetime import datetime, timedelta
from unittest.mock import MagicMock, patch
import pytest
def test_get_daemon_pid_valid(tmp_path):
"""Cover get_daemon_pid with valid running process."""
from code_puppy.scheduler import daemon
pid_file = tmp_path / "sched.pid"
pid_file.... | os.getpid() | assert | func_call | tests/scheduler/test_scheduler_remaining_coverage.py | test_get_daemon_pid_valid | 270 | null | |
mpfaffenberger/code_puppy | import pytest
from code_puppy.hook_engine.aliases import (
ALIAS_LOOKUP,
CLAUDE_CODE_ALIASES,
CODEX_ALIASES,
GEMINI_ALIASES,
PROVIDER_ALIASES,
SWARM_ALIASES,
_build_lookup,
get_aliases,
resolve_internal_name,
)
class TestAliasLookup:
def test_all_keys_are_lowercase(self):
... | key.lower() | assert | func_call | tests/hook_engine/test_aliases.py | test_all_keys_are_lowercase | TestAliasLookup | 36 | null |
mpfaffenberger/code_puppy | import base64
import json
import time
from unittest.mock import AsyncMock, MagicMock, Mock, patch
import httpx
import pytest
from code_puppy.claude_cache_client import (
CLAUDE_CLI_USER_AGENT,
TOKEN_MAX_AGE_SECONDS,
TOOL_PREFIX,
ClaudeCacheAsyncClient,
_inject_cache_control_in_payload,
patch_a... | age | assert | variable | tests/test_claude_cache_client_full_coverage.py | test_with_iat | TestJWTAge | 63 | null |
mpfaffenberger/code_puppy | import json
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from pydantic_ai.messages import ModelRequest, ModelResponse, TextPart
from code_puppy.tools.agent_tools import (
_generate_session_hash_suffix,
_load_session_history,
_save_session_history,
_... | 6 | assert | numeric_literal | tests/test_agent_tools.py | test_hash_format | TestGenerateSessionHashSuffix | 116 | null |
mpfaffenberger/code_puppy | import pytest
from code_puppy.command_line.command_registry import (
CommandInfo,
clear_registry,
get_all_commands,
get_command,
get_unique_commands,
register_command,
)
class TestGetUniqueCommands:
def setup_method(self):
"""Clear registry before each test."""
clear_regis... | 1 | assert | numeric_literal | tests/test_command_registry.py | test_get_unique_commands_no_duplicates | TestGetUniqueCommands | 355 | null |
mpfaffenberger/code_puppy | from code_puppy.tools import file_modifications
def test_replace_in_file_missing_file(tmp_path):
"""_replace_in_file returns an error dict for a nonexistent file."""
missing = str(tmp_path / "nonexistent.txt")
res = file_modifications._replace_in_file(
None, missing, [{"old_str": "a", "new_str": "b... | res | assert | variable | tests/test_file_modification_auxiliary.py | test_replace_in_file_missing_file | 10 | null | |
mpfaffenberger/code_puppy | import asyncio
from unittest.mock import patch
import pytest
from code_puppy.callbacks import (
clear_callbacks,
count_callbacks,
get_callbacks,
on_custom_command,
on_edit_file,
on_load_model_config,
on_post_tool_call,
on_pre_tool_call,
on_startup,
on_stream_event,
register... | 2 | assert | numeric_literal | tests/test_callbacks_extended.py | test_register_multiple_callbacks | TestCallbacksExtended | 63 | null |
mpfaffenberger/code_puppy | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
from prompt_toolkit.document import Document
class TestMarkdownPatches:
def test_patch_idempotent(self):
"""Line 51: second call is no-op."""
from code_puppy.messaging import markdown_patches
ma... | True | assert | bool_literal | tests/test_completions_and_small_modules.py | test_patch_idempotent | TestMarkdownPatches | 496 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import patch
import pytest
from code_puppy.tools.agent_tools import (
AgentInfo,
AgentInvokeOutput,
ListAgentsOutput,
_generate_dbos_workflow_id,
_generate_session_hash_suffix,
_get_subagent_sessions_dir,
_load_session_history,
_save_session_history,
... | [] | assert | collection | tests/test_agent_tools_full_coverage.py | test_load_nonexistent | TestSessionHistory | 86 | null |
mpfaffenberger/code_puppy | import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.tools.agent_tools import (
AgentInfo,
AgentInvokeOutput,
ListAgentsOutput,
_generate_dbos_workflow_id,
_get_subagent_sessions_dir,
register_invoke_agent,
register_list_agents,
... | None | assert | none_literal | tests/test_agent_tools_coverage.py | test_list_agents_returns_available_agents | TestRegisterListAgentsExecution | 279 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import patch
import pytest
from code_puppy.tools.agent_tools import (
AgentInfo,
AgentInvokeOutput,
ListAgentsOutput,
_generate_dbos_workflow_id,
_generate_session_hash_suffix,
_get_subagent_sessions_dir,
_load_session_history,
_save_session_history,
... | 2 | assert | numeric_literal | tests/test_agent_tools_full_coverage.py | test_save_update_metadata | TestSessionHistory | 79 | null |
mpfaffenberger/code_puppy | import configparser
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy import callbacks, session_storage
from code_puppy import config as cp_config
def mock_config_paths(monkeypatch, tmp_path):
"""Mock XDG paths for isolated testing."""
mock_config_dir = str(tmp_... | 1 | assert | numeric_literal | tests/test_config_and_storage_edge_cases.py | test_clear_callbacks_specific_phase | TestCallbacksErrorHandling | 383 | null |
mpfaffenberger/code_puppy | import os
import pytest
from rich.table import Table
from code_puppy.command_line.utils import list_directory, make_directory_table
class TestIntegration:
def test_list_and_table_consistency(self, tmp_path):
"""Test that list_directory and make_directory_table use same data."""
# Create test con... | 1 | assert | numeric_literal | tests/test_command_line_utils.py | test_list_and_table_consistency | TestIntegration | 225 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import AsyncMock, Mock, patch
import httpx
import pytest
from code_puppy.chatgpt_codex_client import (
ChatGPTCodexAsyncClient,
_is_reasoning_model,
create_codex_async_client,
)
class TestConvertStreamToResponse:
@pytest.mark.asyncio
async def test_handle_empty_str... | [] | assert | collection | tests/test_chatgpt_codex_client.py | test_handle_empty_stream | TestConvertStreamToResponse | 484 | null |
mpfaffenberger/code_puppy | import asyncio
import os
import sys
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.tools.ask_user_question.handler import (
_cancelled_response,
_format_validation_error,
_run_interactive_picker,
ask_user_question,
is_interactive,
)
class TestCancelledResponse:
def t... | None | assert | none_literal | tests/test_ask_user_question_full_coverage.py | test_returns_cancelled | TestCancelledResponse | 50 | null |
mpfaffenberger/code_puppy | import os
import tempfile
from unittest.mock import patch
import pytest
from code_puppy.command_line.utils import (
_reset_windows_console,
list_directory,
make_directory_table,
safe_input,
)
class TestSafeInput:
@patch("code_puppy.command_line.utils._reset_windows_console")
@patch("builtins... | "" | assert | string_literal | tests/command_line/test_utils.py | test_empty_input | TestSafeInput | 75 | null |
mpfaffenberger/code_puppy | import asyncio
import os
import sys
from unittest.mock import MagicMock, patch
import pytest
from code_puppy.tools.ask_user_question.handler import (
_cancelled_response,
_format_validation_error,
_run_interactive_picker,
ask_user_question,
is_interactive,
)
class TestAskUserQuestion:
def te... | 1 | assert | numeric_literal | tests/test_ask_user_question_full_coverage.py | test_success | TestAskUserQuestion | 313 | null |
mpfaffenberger/code_puppy | import configparser
import os
from unittest.mock import MagicMock, mock_open, patch
import pytest
from code_puppy import config as cp_config
CONFIG_DIR_NAME = ".code_puppy"
CONFIG_FILE_NAME = "puppy.cfg"
DEFAULT_SECTION_NAME = "puppy"
def mock_config_paths(monkeypatch):
# Ensure that tests don't interact with t... | True | assert | bool_literal | tests/test_config.py | test_get_yolo_mode_not_in_config_defaults_true | TestGetYoloMode | 550 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
import time
import pytest
from .accounts import AccountManager
from .config import ANTIGRAVITY_OAUTH_CONFIG
from .constants import ANTIGRAVITY_MODELS, ANTIGRAVITY_SCOPES
from .oauth import (
_compute_code_challenge,
_decode_state,
_encode_state,
_generate_code_verif... | 2 | assert | numeric_literal | code_puppy/plugins/antigravity_oauth/test_plugin.py | test_migrate_v1_to_v2 | TestStorageMigration | 183 | null |
mpfaffenberger/code_puppy | import json
from unittest.mock import AsyncMock, Mock, patch
import httpx
import pytest
from code_puppy.chatgpt_codex_client import (
ChatGPTCodexAsyncClient,
_is_reasoning_model,
create_codex_async_client,
)
class TestConvertStreamToResponse:
@pytest.mark.asyncio
async def test_collect_text_del... | 1 | assert | numeric_literal | tests/test_chatgpt_codex_client.py | test_collect_text_deltas | TestConvertStreamToResponse | 323 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from unittest.mock import MagicMock, patch
import pytest
_REVIEWER_AGENTS = [
("code_puppy.agents.agent_c_reviewer", "CReviewerAgent"),
("code_puppy.agents.agent_code_reviewer", "CodeQualityReviewerAgent"),
("code_puppy.... | True | assert | bool_literal | tests/test_coverage_agents_gaps.py | test_timeout_response | TestAskUserQuestionModelsGaps | 296 | null |
mpfaffenberger/code_puppy | from code_puppy.messaging.spinner.spinner_base import SpinnerBase
def test_context_info():
SpinnerBase.set_context_info("test info")
assert SpinnerBase.get_context_info() == "test info"
SpinnerBase.clear_context_info()
assert SpinnerBase.get_context_info() == | "" | assert | string_literal | tests/messaging/spinner/test_spinner_base_coverage.py | test_context_info | 53 | null | |
mpfaffenberger/code_puppy | import json
from datetime import datetime
from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from pydantic_ai.messages import (
ModelRequest,
ModelResponse,
SystemPromptPart,
TextPart,
ToolCallPart,
ToolReturnPart,
UserPromptPart,
)
from pydantic_ai.models impo... | 0 | assert | numeric_literal | tests/test_gemini_code_assist.py | test_usage_default | TestStreamedResponse | 338 | null |
mpfaffenberger/code_puppy | import configparser
import os
import tempfile
from unittest.mock import patch
import pytest
from code_puppy.config import (
DEFAULT_SECTION,
get_allow_recursion,
get_auto_save_session,
get_compaction_threshold,
get_diff_context_lines,
get_global_model_name,
get_message_limit,
get_owner... | True | assert | bool_literal | tests/test_config_extended_part1.py | test_boolean_conversion_true_values | TestConfigExtendedPart1 | 110 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.