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

Function test_iter_raw_with_chunksize

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

Source from the content-addressed store, hash-verified

396
397
398def test_iter_raw_with_chunksize():
399 response = httpx.Response(200, content=streaming_body())
400 parts = list(response.iter_raw(chunk_size=5))
401 assert parts == [b"Hello", b", wor", b"ld!"]
402
403 response = httpx.Response(200, content=streaming_body())
404 parts = list(response.iter_raw(chunk_size=7))
405 assert parts == [b"Hello, ", b"world!"]
406
407 response = httpx.Response(200, content=streaming_body())
408 parts = list(response.iter_raw(chunk_size=13))
409 assert parts == [b"Hello, world!"]
410
411 response = httpx.Response(200, content=streaming_body())
412 parts = list(response.iter_raw(chunk_size=20))
413 assert parts == [b"Hello, world!"]
414
415
416def test_iter_raw_doesnt_return_empty_chunks():

Callers

nothing calls this directly

Calls 2

iter_rawMethod · 0.95
streaming_bodyFunction · 0.70

Tested by

no test coverage detected