Files
AstrBot/tests/dashboard/test_chat_conversation.py
LIghtJUNction dcaaf6286a test: comprehensive test coverage and type fixes
- Add 100+ new test files covering provider sources, platform adapters,
  agent runners, star/plugin system, knowledge base, core utils,
  pipeline, computer tools, builtin commands, and dashboard routes
- Fix Python type errors in sqlite.py (col() wrappers for SQLModel),
  astr_agent_tool_exec, core_lifecycle, star context/manager
- Fix TypeScript strict mode errors across 30+ dashboard Vue files
- Add import smoke tests, auth roundtrip, startup tests
- Add compile-all check and CLI entry test for AUR compatibility
- Restore BotMessageAccumulator and helpers lost in merge
2026-04-29 06:29:56 +08:00

63 lines
1.9 KiB
Python

"""Import smoke tests for chat and conversation route modules.
Verifies that all public classes and key standalone functions from
``chat.py`` and ``conversation.py`` can be imported without errors.
"""
# ---------------------------------------------------------------------------
# chat.py — ChatRoute, helper classes and standalone functions
# ---------------------------------------------------------------------------
from astrbot.dashboard.routes.chat import (
BotMessageAccumulator, # noqa: F401
ChatRoute, # noqa: F401
SSE_HEARTBEAT, # noqa: F401
_poll_webchat_stream_result, # noqa: F401
collect_plain_text_from_message_parts, # noqa: F401
extract_reasoning_from_message_parts, # noqa: F401
track_conversation, # noqa: F401
)
def test_chat_route_class():
assert ChatRoute is not None
def test_bot_message_accumulator_class():
assert BotMessageAccumulator is not None
def test_sse_heartbeat_constant():
assert SSE_HEARTBEAT == ": heartbeat\n\n"
def test_poll_webchat_stream_result_is_coroutine_function():
import asyncio
assert asyncio.iscoroutinefunction(_poll_webchat_stream_result)
def test_collect_plain_text_from_message_parts_is_callable():
assert callable(collect_plain_text_from_message_parts)
def test_extract_reasoning_from_message_parts_is_callable():
assert callable(extract_reasoning_from_message_parts)
def test_track_conversation_is_async_context_manager():
import inspect
assert inspect.isasyncgenfunction(track_conversation)
# ---------------------------------------------------------------------------
# conversation.py — ConversationRoute
# ---------------------------------------------------------------------------
from astrbot.dashboard.routes.conversation import ( # noqa: F401
ConversationRoute,
)
def test_conversation_route_class():
assert ConversationRoute is not None