repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
QwenPaw
tests/unit/plugins/computer_use/test_desktop_contention.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Waiting for another session's turn at the desktop. The helper refuses immediately when another session holds the desktop rather than queueing the request, so the waiting happens on this side. That placement is the point: a thread parked inside the helper is...
254
8,475
QwenPaw
tests/unit/plugins/computer_use/test_runtime_availability.py
.py
# -*- coding: utf-8 -*- """Whether Computer Use reports itself usable, and on what grounds. The desktop shell offers a control endpoint on every platform it runs on, but the native helper is built only for Windows and macOS. Treating the endpoint as the whole answer registered the tool on Linux, where every call could...
73
2,585
QwenPaw
tests/unit/plugins/computer_use/conftest.py
.py
# -*- coding: utf-8 -*- """Make the in-repo Computer Use plugin importable for its tests. The plugin ships as a directory under ``plugins/`` rather than as an installed package, so its own modules are not on ``sys.path``. The tests live here, under ``tests/unit``, so the standard suite collects them without any CI wor...
32
792
QwenPaw
tests/unit/runtime/test_project_dir_override.py
.py
# -*- coding: utf-8 -*- """Trusted request-scoped project directory overrides.""" from __future__ import annotations # Tests target request-scope helpers directly. # pylint: disable=protected-access from types import SimpleNamespace import pytest from qwenpaw.agents.acp.meta import ACP_PROJECT_DIR_META_KEY from qw...
157
4,573
QwenPaw
tests/unit/runtime/test_slash_command_registry_advertisable.py
.py
# -*- coding: utf-8 -*- """Tests for SlashCommandRegistry.advertisable_commands().""" from __future__ import annotations from qwenpaw.runtime.slash_command_registry import ( CommandSpec, SlashCommandRegistry, ) def _noop_handler(_ctx, _args): # noqa: W0613 """Dummy async handler for testing.""" retu...
132
3,894
QwenPaw
tests/unit/runtime/test_runtime_malformed_tool_call.py
.py
# -*- coding: utf-8 -*- """Malformed tool_call death-loop regression tests. Regression for #5717: malformed tool_call must not death-loop. The QwenPaw defence against a malformed ``tool_call.input`` JSON string is ``_coerce_tool_inputs_to_json`` in ``qwenpaw.agents.utils.tool_message_utils``, which runs on every mode...
195
7,135
QwenPaw
tests/unit/runtime/test_builtin_commands_scroll.py
.py
# -*- coding: utf-8 -*- """Tests for the conversation-command adapter's scroll-checkpoint handling. Pins ``_resolve_scroll_block`` — the rule that keeps the scroll context manager's persisted bookkeeping consistent with what a command did to the live window (update on /compact, reset on /clear, preserve otherwise). Th...
75
2,110
QwenPaw
tests/unit/runtime/test_llm_acquire_timeout.py
.py
# -*- coding: utf-8 -*- """LLM acquire timeout regression tests. Regression for #5411: LLM acquire timeout must not leave the agent hung. When ``LLMRateLimiter.acquire()`` times out (an internal acquire timeout, distinct from an API 429), ``RetryChatModel.__call__`` must raise ``_AcquireTimeoutError`` immediately (no...
227
7,350
QwenPaw
tests/unit/runtime/test_approval_commands.py
.py
# -*- coding: utf-8 -*- """Tests for root-session approval fallback to spawned subagents.""" from __future__ import annotations from types import SimpleNamespace from qwenpaw.app.approvals.service import ApprovalService from qwenpaw.runtime.commands.control.approval_handler import ( ApprovalCommandHandler, ) fro...
88
2,410
QwenPaw
tests/unit/runtime/test_builder_scroll_migration.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Scroll schema migration must not block the request event loop.""" import asyncio import threading from types import SimpleNamespace import pytest import qwenpaw.agents.context as context_mod from qwenpaw.runtime.builder import AgentBuilder @pytest.mark....
60
1,534
QwenPaw
tests/unit/runtime/test_builtin_commands_help_text.py
.py
# -*- coding: utf-8 -*- """help_text for built-in commands comes from the definition site.""" from __future__ import annotations from qwenpaw.agents.command_handler import SYSTEM_COMMAND_DESCRIPTIONS from qwenpaw.runtime.builtin_commands import ( _collect_control_specs, _collect_conversation_specs, ) def tes...
36
1,409
QwenPaw
tests/unit/runtime/test_tool_guard_async_offload.py
.py
# -*- coding: utf-8 -*- """Ensure ToolGuard engine.guard is offloaded off the event loop.""" from __future__ import annotations from types import SimpleNamespace from unittest.mock import AsyncMock, MagicMock, patch import pytest from qwenpaw.security.tool_guard.models import ToolGuardResult @pytest.mark.asyncio ...
53
1,576
QwenPaw
tests/unit/runtime/test_install_smoke.py
.py
# -*- coding: utf-8 -*- """Install / app startup smoke regression tests. Regression for #5379: install must produce a working app. After running the equivalent of ``qwenpaw init --defaults --accept-security`` the working dir must contain a valid, parseable ``config.json`` and the FastAPI application must be importabl...
162
6,347
QwenPaw
tests/unit/runtime/test_message_convert.py
.py
# -*- coding: utf-8 -*- """Tests for request-to-AgentScope message conversion.""" from qwenpaw.constant import ( EXTERNAL_USER_QUERY_MESSAGE_TAG, QWENPAW_CLIENT_MESSAGE_ID_KEY, QWENPAW_MESSAGE_TAG_KEY, ) from qwenpaw.runtime.message_convert import _request_input_to_msgs from qwenpaw.schemas import AudioCon...
70
2,068
QwenPaw
tests/unit/runtime/test_scroll_recall_gate.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """The builder's two scroll recall gates. ``_scroll_recall_runnable`` — whether scroll is wired at all. The sandboxed ``recall_history_python`` REPL fails closed without a ``sandbox_config`` (the governor injects it); the structured ``recall_history`` tool run...
162
6,234
QwenPaw
tests/unit/runtime/test_prompt_contributors.py
.py
# -*- coding: utf-8 -*- """Tests for runtime prompt contributors.""" from types import SimpleNamespace import pytest from qwenpaw.runtime.prompt_contributors import ( WorkspacePromptFilesContributor, build_default_prompt_manager, ) def _ctx(tmp_path, system_prompt_files): return SimpleNamespace( ...
111
3,739
QwenPaw
tests/unit/runtime/test_envelope_metadata.py
.py
# -*- coding: utf-8 -*- """Tests for AgentScope event metadata in real-time envelopes.""" from __future__ import annotations from types import SimpleNamespace from typing import Any, AsyncGenerator import pytest from agentscope.event import EventType from qwenpaw.runtime.envelope import Envelope, _propagate_event_m...
323
9,300
QwenPaw
tests/unit/providers/test_provider_manager.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,unused-argument,protected-access from __future__ import annotations import json from types import SimpleNamespace import pytest import qwenpaw.providers.provider_manager as provider_manager_module from qwenpaw.config.config import ModelSlotConfig from qw...
1,118
36,252
QwenPaw
tests/unit/providers/test_retry_chat_model.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,too-few-public-methods from __future__ import annotations from types import SimpleNamespace from typing import Any, AsyncGenerator, cast import pytest from agentscope.message import ( Msg, TextBlock, ThinkingBlock, ToolCallBlock, ToolResul...
669
20,584
QwenPaw
tests/unit/providers/test_capping_formatter.py
.py
# -*- coding: utf-8 -*- """Tests for the shared capping-formatter module. agentscope's chat formatters (OpenAI, Anthropic, Gemini, DashScope) all read every local ``file://`` media source off disk and base64-encode the entire file into the request body on every API call. For a large file persisted in conversation his...
324
11,184
QwenPaw
tests/unit/providers/test_gemini_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,unused-argument,protected-access from __future__ import annotations import asyncio import copy from types import SimpleNamespace import pytest from google.genai import errors as genai_errors from google.genai import types as genai_types import qwenpaw.pr...
583
16,481
QwenPaw
tests/unit/providers/test_openai_response_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations import time from types import SimpleNamespace import httpx import pytest from agentscope.model import OpenAIResponseModel from openai import BadRequestError from qwenpaw.providers.multimodal_prober import _PROBE_VIDEO_URL f...
494
12,360
QwenPaw
tests/unit/providers/test_volcengine_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,unused-argument,protected-access """Tests for the Volcano Engine built-in providers.""" from __future__ import annotations import pytest import qwenpaw.providers.provider_manager as provider_manager_module from qwenpaw.providers.openai_provider import Ope...
100
3,646
QwenPaw
tests/unit/providers/test_model_capability_cache.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,redefined-outer-name from __future__ import annotations import time from unittest import mock import pytest from qwenpaw.providers.model_capability_cache import ModelCapabilityCache _TTL = "qwenpaw.providers.model_capability_cache.CAPABILITY_CACHE_TTL_SECON...
117
3,928
QwenPaw
tests/unit/providers/test_dashscope_capping_formatter.py
.py
# -*- coding: utf-8 -*- """Tests for the DashScope provider's oversized-media capping formatter. agentscope's base DashScope formatter reads every local ``file://`` media source off disk and base64-encodes the entire file into the request body on every API call. For a large file persisted in conversation history (e.g...
121
4,337
QwenPaw
tests/unit/providers/test_openai_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations from types import SimpleNamespace from agentscope.model import OpenAIChatModel import qwenpaw.providers.openai_provider as openai_provider_module from qwenpaw.providers.openai_provider import OpenAIProvider def _make_prov...
690
19,694
QwenPaw
tests/unit/providers/test_rate_limiter.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations import time import pytest from qwenpaw.providers.rate_limiter import LLMRateLimiter, _limiters @pytest.fixture(autouse=True) def _reset_global_limiters(): """Ensure each test starts with a clean global limiter registr...
146
4,794
QwenPaw
tests/unit/providers/test_ollama_provider.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import pytest from qwenpaw.providers.ollama_provider import OllamaProvider def _make_provider(base_url: str = "http://localhost:11434") -> OllamaProvider: return OllamaProvider( id="ollama", name="Ollama", base_url=base_url, ...
139
3,588
QwenPaw
tests/unit/providers/test_context_windows.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,missing-function-docstring # pylint: disable=too-few-public-methods,unused-argument # pylint: disable=unsubscriptable-object """The static context-window catalog and its wiring into providers. The compaction trigger is ``trigger_ratio * model.context_size``; b...
336
10,239
QwenPaw
tests/unit/providers/test_provider_class_identity.py
.py
# -*- coding: utf-8 -*- """Tests for ModelInfo class-identity resilience (issues #3301 / #3375). When the same module is loaded via two different import paths (e.g. PYTHONPATH=src/ combined with a pip-installed package), Python creates two distinct class objects for ModelInfo. Pydantic v2 treats them as incompatible ...
193
7,275
QwenPaw
tests/unit/providers/test_kimi_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,unused-argument,protected-access """Tests for the Kimi built-in providers.""" from __future__ import annotations from types import SimpleNamespace import pytest import qwenpaw.providers.provider_manager as provider_manager_module from qwenpaw.providers.o...
180
6,231
QwenPaw
tests/unit/providers/test_anthropic_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access from __future__ import annotations import time from types import SimpleNamespace import qwenpaw.providers.anthropic_provider as anthropic_provider_module from qwenpaw.providers.anthropic_provider import AnthropicProvider def _make_provider(is_custom: bool =...
442
11,904
QwenPaw
tests/unit/providers/test_openai_tool_schema_compat.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import asyncio from typing import Any import jsonschema import pytest from agentscope.tool import Toolkit from qwenpaw.agents.tools.file_io import read_file from qwenpaw.agents.tools.shell import execute_shell_command from qwenpaw.governance import PolicyGua...
312
9,318
QwenPaw
tests/unit/providers/test_mimo_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,unused-argument,protected-access """Tests for the Xiaomi MiMo Token Plan built-in provider.""" from __future__ import annotations import pytest import qwenpaw.providers.provider_manager as provider_manager_module from qwenpaw.providers.openai_provider imp...
90
3,181
QwenPaw
tests/unit/providers/test_siliconflow_provider.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,unused-argument,protected-access """Tests for the SiliconFlow built-in providers.""" from __future__ import annotations from types import SimpleNamespace import pytest import qwenpaw.providers.provider_manager as provider_manager_module from qwenpaw.prov...
95
3,403
QwenPaw
tests/unit/providers/test_opencode_provider.py
.py
# -*- coding: utf-8 -*- """Unit tests for the OpenCode built-in provider. After review feedback: OPENCODE_MODELS reduced to 8 intersection models (Zen ∩ Go), endpoint filtering removed for minimal diff. """ from qwenpaw.providers.provider_manager import ( OPENCODE_MODELS, PROVIDER_OPENCODE, ProviderManage...
88
3,560
QwenPaw
tests/unit/providers/test_openai_stream_toolcall_compat.py
.py
# -*- coding: utf-8 -*- from __future__ import annotations import json from datetime import datetime from types import SimpleNamespace from typing import Any import pytest from agentscope.credential import OpenAICredential from agentscope.message import ToolCallBlock from agentscope.model._model_response import ChatR...
407
12,650
QwenPaw
tests/unit/providers/test_capability_baseline.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,redefined-outer-name from __future__ import annotations import pytest from qwenpaw.providers.capability_baseline import ( ExpectedCapability, ExpectedCapabilityRegistry, compare_probe_result, generate_summary, ) # ----------------------------...
217
5,974
QwenPaw
tests/unit/channels/test_onebot_channel.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Unit tests for OneBot v11 channel.""" from __future__ import annotations import asyncio import logging from typing import Any from unittest.mock import AsyncMock, MagicMock import pytest from aiohttp import web from aiohttp.test_utils import make_mocked_req...
1,741
57,073
QwenPaw
tests/unit/channels/test_discord.py
.py
# -*- coding: utf-8 -*- """ Discord Channel Unit Tests Generated using python-test-pattern skill v0.3.0 Tests cover: initialization, factory methods, message chunking, session resolution, target routing, async send operations, and lifecycle management. Run: pytest tests/unit/channels/test_discord.py -v """ # pyli...
946
32,505
QwenPaw
tests/unit/channels/test_wecom.py
.py
# -*- coding: utf-8 -*- """ WeCom (Enterprise WeChat) Channel Unit Tests Comprehensive unit tests for WecomChannel covering: - Initialization and configuration - Factory methods (from_env, from_config) - Session ID resolution and routing - Message deduplication (thread safety) - Message handling (text, image, voice, f...
1,519
48,584
QwenPaw
tests/unit/channels/test_sip_memory_bounds.py
.py
# -*- coding: utf-8 -*- """Regression tests for bounded SIP channel state.""" # pylint: disable=missing-function-docstring,protected-access from __future__ import annotations import asyncio from unittest.mock import MagicMock from qwenpaw.app.channels.sip.livekit_backend import ( _put_latest_audio as lk_put, ) fr...
94
2,950
QwenPaw
tests/unit/channels/test_console.py
.py
# -*- coding: utf-8 -*- """ Console Channel Unit Tests - Simple Channel Template This serves as the reference implementation for testing simple channels. For complex channels with external dependencies (HTTP, WebSocket), see test_dingtalk.py for advanced patterns. Key patterns demonstrated: 1. Basic initialization t...
928
28,242
QwenPaw
tests/unit/channels/test_telegram.py
.py
# -*- coding: utf-8 -*- """ Telegram Channel Unit Tests Comprehensive unit tests for TelegramChannel covering: - Initialization and configuration - Factory methods (from_env, from_config) - Message chunking and formatting - Typing indicators - Send methods (text and media) - Session resolution and routing - File downl...
1,979
68,457
QwenPaw
tests/unit/channels/test_yuanbao.py
.py
# -*- coding: utf-8 -*- """ Yuanbao Channel Unit Tests Tests cover: initialization, factory methods, codec, auth, media upload, message sending, session routing. Run: pytest tests/unit/channels/test_yuanbao.py -v """ # pylint: disable=redefined-outer-name,protected-access,unused-argument from __future__ import an...
1,646
56,926
QwenPaw
tests/unit/channels/test_onebot_media.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Unit tests for OneBot inbound media localization.""" from __future__ import annotations import asyncio from pathlib import Path from typing import Any from unittest.mock import AsyncMock import aiohttp import pytest from qwenpaw.app.channels.onebot.media...
479
11,989
QwenPaw
tests/unit/channels/test_xiaoyi.py
.py
# -*- coding: utf-8 -*- """ XiaoYi Channel Unit Tests Generated using python-test-pattern skill v0.2.0 Tests cover: initialization, factory methods, lifecycle, message handling, WebSocket operations Run: pytest tests/unit/channels/test_xiaoyi.py -v """ # pylint: disable=redefined-outer-name,protected-access,unuse...
1,304
42,601
QwenPaw
tests/unit/channels/test_voice.py
.py
# -*- coding: utf-8 -*- """ Voice Channel Unit Tests Generated using python-test-pattern skill v0.2.0 Tests cover: initialization, factory methods, lifecycle, core features Run: pytest tests/unit/channels/test_voice.py -v """ # pylint: disable=redefined-outer-name,protected-access,unused-argument from __future__ ...
662
21,448
QwenPaw
tests/unit/channels/test_wechat.py
.py
# -*- coding: utf-8 -*- """ WeChat Channel Unit Tests Comprehensive unit tests for WeChatChannel covering: - Initialization and configuration - Factory methods (from_env, from_config) - Session ID resolution and routing - Token persistence (save/load) - Message deduplication (thread safety) - HTTP API interactions (mo...
1,574
51,365
QwenPaw
tests/unit/channels/test_qq.py
.py
# -*- coding: utf-8 -*- """ QQ Channel Unit Tests Comprehensive unit tests for QQChannel covering: - Initialization and configuration - Factory methods (from_env, from_config) - Utility functions (_sanitize_qq_text, _as_bool, _is_url_content_error, etc.) - Token management (sync/async) - Message sending with fallback ...
2,108
68,984
QwenPaw
tests/unit/channels/test_qrcode_auth_handler.py
.py
# -*- coding: utf-8 -*- """Unit tests for Feishu and DingTalk QR Code Auth Handlers.""" # pylint: disable=redefined-outer-name,protected-access from __future__ import annotations from unittest.mock import AsyncMock, MagicMock, patch import pytest from fastapi import HTTPException @pytest.fixture def mock_request():...
431
13,253
QwenPaw
tests/unit/channels/test_feishu.py
.py
# -*- coding: utf-8 -*- """ Feishu Channel Unit Tests Comprehensive unit tests for FeishuChannel covering: - Initialization and configuration (from_env, from_config) - Session ID resolution and routing - Receive ID store management (for proactive send) - Message deduplication - Nickname caching - Utility methods (sync...
3,578
118,923
QwenPaw
tests/unit/channels/test_mattermost.py
.py
# -*- coding: utf-8 -*- """ Mattermost Channel Unit Tests Comprehensive unit tests for MattermostChannel covering: - Initialization and configuration - Factory methods (from_env, from_config) - Session ID resolution and routing - HTTP API interactions (mocked) - Send methods (text and media) - File upload and download...
1,977
63,379
QwenPaw
tests/unit/channels/test_slack.py
.py
# -*- coding: utf-8 -*- """ Slack Channel Unit Tests (Corrected) All tests pass after adjusting mocks and fixing test expectations. Note: Some business logic bugs identified in the process are documented in the analysis (e.g., markdown conversion, rich text extraction). """ # pylint: disable=redefined-outer-name,prote...
3,023
100,754
QwenPaw
tests/unit/channels/test_dingtalk.py
.py
# -*- coding: utf-8 -*- """ DingTalk Channel Unit Tests Comprehensive unit tests for DingTalkChannel covering: - Initialization and configuration - Session webhook management (storage/retrieval/expiry) - Token caching mechanism - Message deduplication (thread safety) - Send methods (webhook, Open API, AI Card) - Utili...
3,497
115,712
QwenPaw
tests/unit/channels/test_mqtt.py
.py
# -*- coding: utf-8 -*- """ MQTT Channel Unit Tests Generated using python-test-pattern skill v0.2.0 Tests cover: initialization, factory methods, lifecycle, message handling Run: pytest tests/unit/channels/test_mqtt.py -v """ # pylint: disable=redefined-outer-name,protected-access,unused-argument from __future__...
923
30,773
QwenPaw
tests/unit/channels/test_imessage.py
.py
# -*- coding: utf-8 -*- """ Unit tests for IMessageChannel. Tests cover initialization, factory methods, lifecycle, and core functionality. Platform-specific code is handled with @pytest.mark.skipif decorators. """ # pylint: disable=redefined-outer-name,protected-access,unused-argument from __future__ import annotati...
1,018
31,566
QwenPaw
tests/unit/channels/test_matrix.py
.py
# -*- coding: utf-8 -*- """Unit tests for Matrix channel implementation.""" # pylint: disable=redefined-outer-name,unused-import # pylint: disable=protected-access,unused-argument from unittest.mock import AsyncMock, MagicMock, Mock, patch import pytest from nio import ( MatrixRoom, RoomMessageAudio, Room...
1,221
41,231
QwenPaw
tests/unit/channels/conftest.py
.py
# -*- coding: utf-8 -*- """ Channel Unit Test Fixtures Provides common fixtures for channel unit testing. """ from __future__ import annotations import asyncio from typing import Generator from unittest.mock import AsyncMock, MagicMock import pytest @pytest.fixture def mock_process_handler() -> AsyncMock: """...
51
1,221
QwenPaw
tests/unit/channels/test_base_core.py
.py
# -*- coding: utf-8 -*- """ BaseChannel Core Unit Tests ============================ Division of Labor with Contract Tests: - Contract Tests (tests/contract/channels/): Verify external interface contracts, prevent breaking subclasses - This Unit Test (tests/unit/channels/): Verify base class internal logic correct...
1,453
46,958
QwenPaw
tests/unit/agents/test_acp_permissions_trusted.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Tests for ACP permission adapter trusted flag and auto-approve logic.""" from __future__ import annotations from qwenpaw.agents.acp.permissions import ACPPermissionAdapter class TestACPPermissionAdapterTrusted: """Verify trusted flag is stored and doe...
107
3,372
QwenPaw
tests/unit/agents/test_context_overflow_recovery.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,unused-argument """Tests for the one-shot Scroll recovery on provider context overflow.""" from types import SimpleNamespace from unittest.mock import AsyncMock import pytest from agentscope.agent import Agent from google.genai import errors as genai_errors ...
276
8,150
QwenPaw
tests/unit/agents/test_acp_client_trusted.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Tests for ACPHostedClient trusted auto-approve logic.""" from __future__ import annotations import asyncio from unittest.mock import AsyncMock import pytest from qwenpaw.agents.acp.client import ACPHostedClient from qwenpaw.config.config import ACPAgentCo...
145
4,861
QwenPaw
tests/unit/agents/test_command_handler.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access import json import logging from types import SimpleNamespace from unittest.mock import AsyncMock, MagicMock import pytest from agentscope.message import HintBlock, Msg, TextBlock from qwenpaw.agents.command_handler import CommandHandler from qwenpaw.agents.me...
708
22,472
QwenPaw
tests/unit/agents/test_acp_project_context.py
.py
# -*- coding: utf-8 -*- """ACP session project context metadata.""" from __future__ import annotations from acp import text_block from qwenpaw.agents.acp.meta import ( ACP_EPHEMERAL_META_KEY, ACP_PROJECT_DIR_META_KEY, ) from qwenpaw.agents.acp.server import QwenPawACPAgent class _FakeConn: async def se...
128
3,332
QwenPaw
tests/unit/agents/test_acp_tool_capture.py
.py
# -*- coding: utf-8 -*- """Tests for QwenPaw envelope to ACP tool-call capture.""" from __future__ import annotations from qwenpaw.agents.acp.server import _EnvelopeTracker from qwenpaw.schemas import ( ContentType, DataContent, FunctionCall, FunctionCallOutput, Message, MessageType, Role,...
86
2,409
QwenPaw
tests/unit/agents/test_react_agent_compression.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Agent-level tests for compression strategy middleware wiring.""" from __future__ import annotations from types import SimpleNamespace from typing import Any import pytest from agentscope.agent import Agent, ContextConfig from agentscope.message import Hin...
162
4,901
QwenPaw
tests/unit/agents/test_react_agent_scroll_seen.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,unused-argument """Tests for Scroll's successful-model-input acknowledgement hook.""" from types import SimpleNamespace import pytest from agentscope.agent import Agent from agentscope.event import ModelCallEndEvent from agentscope.message import HintBlock, Ms...
148
4,722
QwenPaw
tests/unit/agents/test_memory_middleware.py
.py
# -*- coding: utf-8 -*- """Tests for MemoryMiddleware automation-source skip logic.""" # pylint: disable=protected-access from __future__ import annotations from types import SimpleNamespace from unittest.mock import AsyncMock, MagicMock, patch import pytest from agentscope.message import ( Msg, TextBlock, ...
832
28,842
QwenPaw
tests/unit/agents/test_create_model_and_formatter_override.py
.py
# -*- coding: utf-8 -*- """Tests for ``create_model_and_formatter`` model override support.""" # pylint: disable=protected-access,redefined-outer-name from types import SimpleNamespace from unittest.mock import patch import pytest from qwenpaw.agents import model_factory from qwenpaw.config import config as config_m...
234
7,859
QwenPaw
tests/unit/agents/test_cross_provider_normalization.py
.py
# -*- coding: utf-8 -*- """Integration tests for cross-provider message normalization. Simulates a conversation that starts on one provider and is then formatted for a *different* provider. The key invariant: provider-specific artefacts from the first provider must not leak into the request payload for the second pro...
498
13,142
QwenPaw
tests/unit/agents/test_acp_runtime_provider.py
.py
# -*- coding: utf-8 -*- """Tests for the ephemeral ACP OpenAI-compatible provider.""" # pylint: disable=protected-access from __future__ import annotations import asyncio from types import SimpleNamespace import pytest from acp import RequestError, text_block from qwenpaw.agents.acp.runtime_provider import ( Q...
389
10,987
QwenPaw
tests/unit/agents/test_acp_tool_params.py
.py
# -*- coding: utf-8 -*- """Tool-call arguments stream in, so the first sighting of a call often carries empty input. The ACP server must emit the populated ``raw_input`` once it arrives (as a follow-up update) rather than pinning the empty ``rawInput`` from the initial ``start`` event.""" from __future__ import annota...
87
2,572
QwenPaw
tests/unit/agents/test_command_handler_scroll.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Tests for ``CommandHandler``'s scroll-aware ``/compact`` wiring. The standalone command handler builds a bare AgentScope ``Agent`` whose ``compress_context`` is always *native*. Under the scroll strategy it must instead drive a ``ScrollContextManager`` — bu...
137
5,123
QwenPaw
tests/unit/agents/test_acp_available_commands.py
.py
# -*- coding: utf-8 -*- """Tests for the ACP agent advertising its slash commands. The ACP server sends an ``available_commands_update`` notification after a session is created so clients (e.g. the paw TUI) can offer autocompletion. """ # pylint: disable=protected-access from __future__ import annotations import as...
828
26,045
QwenPaw
tests/unit/agents/test_tool_result_pruning_middleware.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access,unused-argument,wrong-import-position """Tests for tool-result pruning middleware.""" from __future__ import annotations import asyncio import logging import sys import threading import types from dataclasses import dataclass, field from typing import Any, As...
716
22,152
QwenPaw
tests/unit/agents/test_prompt_sections.py
.py
# -*- coding: utf-8 -*- """Tests for PromptBuilder and plugin prompt section registration.""" from __future__ import annotations from unittest.mock import patch import pytest from qwenpaw.agents.prompt_builder import PromptBuilder from qwenpaw.plugins.registry import PluginRegistry class _FakeAgent: """Minimal...
145
4,022
QwenPaw
tests/unit/agents/test_fork_project.py
.py
# -*- coding: utf-8 -*- """Unit tests for fork worktree path + integration helpers.""" from __future__ import annotations import errno import importlib.util import json import subprocess import sys import threading import time from contextlib import contextmanager from pathlib import Path from types import SimpleName...
1,335
41,362
QwenPaw
tests/unit/agents/test_acp_file_links.py
.py
# -*- coding: utf-8 -*- """The ACP server surfaces files an agent sends (``send_file_to_user``) as a ``resource_link`` tool-call content block, so clients (e.g. the paw TUI) can offer a clickable link instead of a raw dict repr.""" from __future__ import annotations from types import SimpleNamespace import pytest #...
144
4,786
QwenPaw
tests/unit/agents/test_message_request_normalizer.py
.py
# -*- coding: utf-8 -*- """Tests for message_request_normalizer module.""" # pylint: disable=redefined-outer-name,protected-access import json import pytest from agentscope.message import ( DataBlock, Msg, TextBlock, ToolCallBlock, ToolResultBlock, URLSource, ) from qwenpaw.agents.utils.messa...
454
13,102
QwenPaw
tests/unit/agents/test_model_factory_video_capping.py
.py
# -*- coding: utf-8 -*- """Tests for video size capping in the model_factory video helpers. Tool-result videos inline through ``_format_openai_video_block`` and ``_format_anthropic_video_data_block`` rather than the capping formatters (which only intercept ``_format_*_source``), so the inline byte cap is enforced insi...
307
9,370
QwenPaw
tests/unit/agents/test_acp_session_mcp.py
.py
# -*- coding: utf-8 -*- """Tests for ACP session-scoped MCP Driver registration.""" # pylint: disable=protected-access from __future__ import annotations import asyncio from collections.abc import AsyncIterator from pathlib import Path from typing import Any import pytest from acp import text_block from acp.schema ...
456
13,523
QwenPaw
tests/unit/agents/test_model_factory_message_normalization.py
.py
# -*- coding: utf-8 -*- """Tests for model_factory message normalization integration.""" # pylint: disable=protected-access,redefined-outer-name import base64 import json from types import SimpleNamespace import pytest from agentscope.formatter import OpenAIChatFormatter from agentscope.message import ( Base64Sou...
891
25,188
QwenPaw
tests/unit/agents/hooks/test_bootstrap_hook.py
.py
# -*- coding: utf-8 -*- """Tests for BootstrapHook. Covers: - Initialization - __call__ early-exit branches (flag, missing file, not first interaction) - Happy path: guidance prepended, flag created - System message skipping - Exception handling """ # pylint: disable=redefined-outer-name from pathlib import Path from ...
249
7,987
QwenPaw
tests/unit/agents/hooks/test_session_hook.py
.py
# -*- coding: utf-8 -*- """Session hook persistence behavior.""" from __future__ import annotations from types import SimpleNamespace import pytest from qwenpaw.agents.acp.meta import ACP_EPHEMERAL_META_KEY from qwenpaw.hooks.session.session_hook import SessionLoadHook, SessionSaveHook from qwenpaw.hooks.session.si...
90
2,721
QwenPaw
tests/unit/agents/tools/test_shell.py
.py
# -*- coding: utf-8 -*- """Tests for qwenpaw.agents.tools.shell. Covers: - _collapse_embedded_newlines - _sanitize_win_cmd - _read_temp_file - _read_output_snapshot - _open_temp_output - _open_windows_temp_output - _shell_basename - _is_powershell / _is_cmd - _extract_powershell_command - smart_decode - execute_shell_...
2,456
75,446
QwenPaw
tests/unit/agents/tools/test_desktop_screenshot.py
.py
# -*- coding: utf-8 -*- """Tests for desktop_screenshot cancel cleanup.""" # pylint: disable=protected-access from __future__ import annotations import asyncio from unittest.mock import AsyncMock, MagicMock, patch import pytest from agentscope.message import Base64Source from PIL import Image from qwenpaw.agents.to...
74
2,145
QwenPaw
tests/unit/agents/tools/test_agent_management.py
.py
# -*- coding: utf-8 -*- # pylint: disable=protected-access """Tests for agent discovery and inter-agent chat helpers.""" from __future__ import annotations import json import httpx import pytest from agentscope.tool import FunctionTool from agentscope.tool import Toolkit from qwenpaw.agents.tools import agent_manag...
1,221
35,099
QwenPaw
tests/unit/agents/tools/test_delegate_external_agent_timeout.py
.py
# -*- coding: utf-8 -*- """ACP stream loop respects dynamic kill_deadline / extend.""" # pylint: disable=protected-access from __future__ import annotations import asyncio import importlib from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch import pytest from qwenpaw.tool_calls import rese...
160
4,790
QwenPaw
tests/unit/agents/tools/test_file_search.py
.py
# -*- coding: utf-8 -*- """Tests for file_search module — _is_text_file and _walk_and_grep.""" # pylint: disable=redefined-outer-name,protected-access import os import re import tempfile import threading from pathlib import Path import pytest from qwenpaw.agents.tools.file_search import ( _compile_search_pattern...
885
27,797
QwenPaw
tests/unit/agents/tools/test_file_io.py
.py
# -*- coding: utf-8 -*- """Tests for qwenpaw.agents.tools.file_io. Covers: - _resolve_file_path - _get_encoding_for_file - read_file - write_file - edit_file - append_file """ # pylint: disable=protected-access,unused-argument import asyncio import os import stat import threading import time from unittest.mock import...
355
12,131
QwenPaw
tests/unit/agents/tools/test_view_media.py
.py
# -*- coding: utf-8 -*- """Tests for qwenpaw.agents.tools.view_media. Covers: - _is_url - _validate_url_extension - _validate_media_path - _check_multimodal_support - _get_multimodal_fallback_hint - view_image - view_video """ # pylint: disable=protected-access,unused-argument import base64 from io import BytesIO fro...
525
17,746
QwenPaw
tests/unit/agents/context/test_scroll_manager.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,protected-access,unused-argument """Unit tests for :class:`ScrollContextManager`. Covers write-through dedup, the resume checkpoint (no re-append of a restored window), the boundary-Msg double-presence fix, tool-result preview persistence, degraded-durabil...
2,327
76,346
QwenPaw
tests/unit/agents/context/test_repl_state.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name """recall_history_python's final ToolChunk must reflect the subprocess exit. The run has finished by the time the tool returns, so a RUNNING state would leave it looking perpetually in-flight to tool coordination, persisted tool_state, and the model. Exit ...
143
4,626
QwenPaw
tests/unit/agents/context/test_eviction_index.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,protected-access,unused-argument """Unit tests for the in-context eviction index (pure logic, no DB). Covers cap-driven carry, lossless span/headline bookkeeping, the checkpoint round-trip, and the rendered map. """ from qwenpaw.agents.context.scroll.evic...
193
6,452
QwenPaw
tests/unit/agents/context/test_continuation_summary.py
.py
# -*- coding: utf-8 -*- """Tests for Scroll's plain-Markdown continuation summary protocol.""" from qwenpaw.agents.context.scroll.continuation_summary import ( ContinuationSummary, SummarySource, build_update_prompt, extract_identifiers, redact_secrets, parse_plain_markdown, validate_summar...
400
10,996
QwenPaw
tests/unit/agents/context/test_sync.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,protected-access,unused-argument """Unit tests for the ``sessions/*.json`` → ``history.db`` startup sync. Pins the rollout-critical guarantees: non-destructive (source files untouched), idempotent (re-runs and the DB UNIQUE index insert nothing new), faith...
1,062
31,722
QwenPaw
tests/unit/agents/context/test_history_store.py
.py
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name,protected-access,unused-argument """Unit tests for the durable :class:`HistoryStore`. Covers append + idempotency (the ``ux_dedup`` net behind resume/migration), in-place ``update_entry`` with FTS sync, retention ``purge``, the degraded durability flag, an...
502
16,056
QwenPaw
tests/unit/agents/context/test_as_internals_signatures.py
.py
# -*- coding: utf-8 -*- """Signature smoke test for the AgentScope 2.0 private internals the scroll manager depends on. AgentScope 2.0 is alpha. The scroll context manager calls two underscore methods on the agent via :mod:`qwenpaw.agents.context.scroll._as_internals`. If a future AgentScope release renames them or ch...
65
2,315
QwenPaw
tests/unit/agents/context/test_serialize.py
.py
# -*- coding: utf-8 -*- """Headline extraction and display-cleanup regressions.""" import pytest from qwenpaw.agents.context.scroll.prompt import build_scroll_system_prompt from qwenpaw.agents.context.scroll.serialize import ( HeadlineDeltaState, extract_headline, flush_headline_delta, strip_headline,...
207
6,050