MCPcopy Create free account
hub / github.com/commandoperator/cmdop-sdk / test_unary_response_round_trip

Function test_unary_response_round_trip

python/tests/test_transport.py:101–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 await transport.aclose()
100
101
102@pytest.mark.asyncio
103async def test_stream_collects_events_and_rejects_failed_done() -> None:
104 transport, process = _transport()
105 stream = transport.call_stream(
106 pb.Envelope(
107 ask_machine_req=pb.AskMachineRequest(machine_id="m1", prompt="hello")
108 )
109 )
110 collected = asyncio.create_task(stream.collect())
111 request = await _request(process)
112 _feed(
113 process,
114 pb.Envelope(
115 id=request.id,
116 kind=pb.Envelope.KIND_EVENT,
117 ask_event=pb.AskEvent(event_type=pb.AGENT_EVENT_TYPE_TOKEN, payload_json='{"delta":"hi"}'),
118 ),
119 )
120 _feed(
121 process,
122 pb.Envelope(
123 id=request.id,
124 kind=pb.Envelope.KIND_DONE,
125 ask_done=pb.AskDone(success=True),
126 ),
127 )
128 assert await collected == "hi"

Callers

nothing calls this directly

Calls 4

call_unaryMethod · 0.80
_make_transportFunction · 0.70
coreFunction · 0.70
acloseMethod · 0.45

Tested by

no test coverage detected