MCPcopy
hub / github.com/encode/httpx / test_cannot_aread_after_stream_consumed

Function test_cannot_aread_after_stream_consumed

tests/models/test_responses.py:732–743  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

730
731@pytest.mark.anyio
732async def test_cannot_aread_after_stream_consumed():
733 response = httpx.Response(
734 200,
735 content=async_streaming_body(),
736 )
737
738 content = b""
739 async for part in response.aiter_bytes():
740 content += part
741
742 with pytest.raises(httpx.StreamConsumed):
743 await response.aread()
744
745
746def test_cannot_read_after_response_closed():

Callers

nothing calls this directly

Calls 3

aiter_bytesMethod · 0.95
areadMethod · 0.95
async_streaming_bodyFunction · 0.85

Tested by

no test coverage detected