MCPcopy
hub / github.com/urllib3/urllib3 / test_single_chunk

Method test_single_chunk

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

Source from the content-addressed store, hash-verified

66
67class TestBytesQueueBuffer:
68 def test_single_chunk(self) -> None:
69 buffer = BytesQueueBuffer()
70 assert len(buffer) == 0
71 with pytest.raises(RuntimeError, match="buffer is empty"):
72 assert buffer.get(10)
73
74 assert buffer.get(0) == b""
75
76 buffer.put(b"foo")
77 with pytest.raises(ValueError, match="n should be > 0"):
78 buffer.get(-1)
79
80 assert buffer.get(1) == b"f"
81 assert buffer.get(2) == b"oo"
82 with pytest.raises(RuntimeError, match="buffer is empty"):
83 assert buffer.get(10)
84
85 def test_read_too_much(self) -> None:
86 buffer = BytesQueueBuffer()

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
putMethod · 0.95
BytesQueueBufferClass · 0.90

Tested by

no test coverage detected