Something went wrong. Try again.
fork of prime agent with changes i want but are not upstreamable probqbly (and some fixes)
Something went wrong. Try again.
1.8 kB · 40 lines
Python
at main
1234567891011121314151617181920212223242526272829303132333435363738394041from __future__ import annotations
import asyncioimport importlib.utilimport unittestfrom pathlib import Pathfrom unittest.mock import AsyncMock, patch
SKILL = Path(__file__).parents[2] / "packages/coding-agent/skills/agent-message/src/agent_message/__init__.py"
class AgentMessageSkillTest(unittest.TestCase): def test_roled_parent_and_broadcast_forms(self) -> None: spec = importlib.util.spec_from_file_location("agent_message_test", SKILL) assert spec and spec.loader module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) host = AsyncMock(return_value={"deliveryStatus": "queued"}) with patch.object(module, "host_request", host), patch.object(module, "_emit_sent_message"): asyncio.run(module.send("done", receiver_role="parent")) asyncio.run(module.send("all", "follow up")) self.assertEqual(host.await_args_list[0].args[1]["receiver_role"], "parent") self.assertEqual(host.await_args_list[1].args[1]["target"], "all")
def test_roled_selector_validation(self) -> None: spec = importlib.util.spec_from_file_location("agent_message_validation", SKILL) assert spec and spec.loader module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) with self.assertRaisesRegex(ValueError, "required"): asyncio.run(module.send("hello", receiver_role="child")) with self.assertRaisesRegex(ValueError, "omitted"): asyncio.run(module.send("hello", receiver_role="parent", receiver_name="x")) with self.assertRaisesRegex(TypeError, "unexpected keyword argument 'mode'"): asyncio.run(module.send("hello", receiver_role="parent", mode="follow_up"))
if __name__ == "__main__": unittest.main()