MCPcopy
hub / github.com/urllib3/urllib3 / test_decode_zstd_incomplete_read1

Method test_decode_zstd_incomplete_read1

test/test_response.py:647–661  ·  view source on GitHub ↗
(self, data: bytes)

Source from the content-addressed store, hash-verified

645 @onlyZstd()
646 @pytest.mark.parametrize("data", decode_param_set)
647 def test_decode_zstd_incomplete_read1(self, data: bytes) -> None:
648 data = zstd_compress(data)
649 fp = BytesIO(data[:-1])
650
651 r = HTTPResponse(
652 fp, headers={"content-encoding": "zstd"}, preload_content=False
653 )
654
655 # read/decode via read1(!), expecting DecodeError
656 with pytest.raises(DecodeError):
657 amt_decoded = 0
658 # loop, as read1() may return just partial data
659 while amt_decoded < len(data):
660 part = r.read1(decode_content=True)
661 amt_decoded += len(part)
662
663 @onlyZstd()
664 @pytest.mark.parametrize("data", decode_param_set)

Callers

nothing calls this directly

Calls 3

read1Method · 0.95
HTTPResponseClass · 0.90
zstd_compressFunction · 0.85

Tested by

no test coverage detected