MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / test_data_stream_deprecated

Function test_data_stream_deprecated

tests/test_client_request.py:1144–1161  ·  view source on GitHub ↗
(loop, buf, conn)

Source from the content-addressed store, hash-verified

1142
1143
1144async def test_data_stream_deprecated(loop, buf, conn) -> None:
1145 with pytest.warns(DeprecationWarning):
1146
1147 @aiohttp.streamer
1148 async def gen(writer):
1149 await writer.write(b"binary data")
1150 await writer.write(b" result")
1151
1152 req = ClientRequest("POST", URL("http://python.org/"), data=gen(), loop=loop)
1153 assert req.chunked
1154 assert req.headers["TRANSFER-ENCODING"] == "chunked"
1155
1156 resp = await req.send(conn)
1157 await resp.wait_for_close()
1158 assert (
1159 buf.split(b"\r\n\r\n", 1)[1] == b"b\r\nbinary data\r\n7\r\n result\r\n0\r\n\r\n"
1160 )
1161 await req.close()
1162
1163
1164async def test_data_file(loop, buf, conn) -> None:

Callers

nothing calls this directly

Calls 5

sendMethod · 0.95
closeMethod · 0.95
ClientRequestClass · 0.90
wait_for_closeMethod · 0.80
genFunction · 0.70

Tested by

no test coverage detected