Complete implementation of the DCOS package including: - 40+ Python source files across agents, communication, core, learning, memory, protocols, utils - pyproject.toml build configuration - 102 unit tests across all subsystems - Fixed flake.nix (Python 3.12, proper dependencies, pyproject build) - Fixed .woodpecker.yml (correct paths, removed silent-fail flags) - Added .gitignore - Cleared stale pytest cache
28 lines
868 B
Python
28 lines
868 B
Python
"""
|
|
Tests for UserInterface.
|
|
"""
|
|
|
|
import pytest
|
|
from dcos.protocols.user_interface import UserInterface, UserRequest, SystemResponse
|
|
|
|
|
|
class TestUserInterface:
|
|
def test_process_input(self):
|
|
ui = UserInterface()
|
|
request = UserRequest(input="hello", user_id="user_1")
|
|
parsed = ui.process_input(request)
|
|
assert parsed["intent"] == "query"
|
|
|
|
def test_format_response(self):
|
|
ui = UserInterface()
|
|
response = SystemResponse(output="Hello!", agent_id="agent_1")
|
|
formatted = ui.format_response(response)
|
|
assert "[agent_1]" in formatted
|
|
|
|
def test_history(self):
|
|
ui = UserInterface()
|
|
ui.format_response(SystemResponse(output="msg1", agent_id="a"))
|
|
ui.format_response(SystemResponse(output="msg2", agent_id="b"))
|
|
history = ui.get_history()
|
|
assert len(history) == 2
|