MCPcopy
hub / github.com/urllib3/urllib3 / test_chunked_decoding_deflate2

Method test_chunked_decoding_deflate2

test/test_response.py:389–402  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

387 assert r.read() == b""
388
389 def test_chunked_decoding_deflate2(self) -> None:
390 compress = zlib.compressobj(6, zlib.DEFLATED, -zlib.MAX_WBITS)
391 data = compress.compress(b"foo")
392 data += compress.flush()
393
394 fp = BytesIO(data)
395 r = HTTPResponse(
396 fp, headers={"content-encoding": "deflate"}, preload_content=False
397 )
398
399 assert r.read(1) == b"f"
400 assert r.read(2) == b"oo"
401 assert r.read() == b""
402 assert r.read() == b""
403
404 @pytest.mark.parametrize("content_encoding", ["gzip", "x-gzip"])
405 def test_chunked_decoding_gzip(self, content_encoding: str) -> None:

Callers

nothing calls this directly

Calls 3

readMethod · 0.95
HTTPResponseClass · 0.90
flushMethod · 0.45

Tested by

no test coverage detected