MCPcopy
hub / github.com/urllib3/urllib3 / test_incomplete_chunk

Method test_incomplete_chunk

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

Source from the content-addressed store, hash-verified

1774 assert orig_ex.expected == content_length
1775
1776 def test_incomplete_chunk(self) -> None:
1777 stream = [b"foooo", b"bbbbaaaaar"]
1778 fp = MockChunkedIncompleteRead(stream)
1779 r = httplib.HTTPResponse(MockSock) # type: ignore[arg-type]
1780 r.fp = fp # type: ignore[assignment]
1781 r.chunked = True
1782 r.chunk_left = None
1783 resp = HTTPResponse(
1784 r, preload_content=False, headers={"transfer-encoding": "chunked"}
1785 )
1786 with pytest.raises(ProtocolError) as ctx:
1787 next(resp.read_chunked())
1788
1789 orig_ex = ctx.value.args[1]
1790 assert isinstance(orig_ex, httplib_IncompleteRead)
1791
1792 def test_invalid_chunk_length(self) -> None:
1793 stream = [b"foooo", b"bbbbaaaaar"]

Callers

nothing calls this directly

Calls 3

read_chunkedMethod · 0.95
HTTPResponseClass · 0.90

Tested by

no test coverage detected