MCPcopy
hub / github.com/urllib3/urllib3 / test_chunked_decoding_gzip

Method test_chunked_decoding_gzip

test/test_response.py:405–418  ·  view source on GitHub ↗
(self, content_encoding: str)

Source from the content-addressed store, hash-verified

403
404 @pytest.mark.parametrize("content_encoding", ["gzip", "x-gzip"])
405 def test_chunked_decoding_gzip(self, content_encoding: str) -> None:
406 compress = zlib.compressobj(6, zlib.DEFLATED, 16 + zlib.MAX_WBITS)
407 data = compress.compress(b"foo")
408 data += compress.flush()
409
410 fp = BytesIO(data)
411 r = HTTPResponse(
412 fp, headers={"content-encoding": content_encoding}, preload_content=False
413 )
414
415 assert r.read(1) == b"f"
416 assert r.read(2) == b"oo"
417 assert r.read() == b""
418 assert r.read() == b""
419
420 def test_decode_gzip_multi_member(self) -> None:
421 compress = zlib.compressobj(6, zlib.DEFLATED, 16 + zlib.MAX_WBITS)

Callers

nothing calls this directly

Calls 3

readMethod · 0.95
HTTPResponseClass · 0.90
flushMethod · 0.45

Tested by

no test coverage detected