()
| 99 | await transport.aclose() |
| 100 | |
| 101 | |
| 102 | @pytest.mark.asyncio |
| 103 | async 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" |
nothing calls this directly
no test coverage detected