MCPcopy Index your code
hub / github.com/python/cpython / test_blocksize_request

Method test_blocksize_request

Lib/test/test_httplib.py:1102–1112  ·  view source on GitHub ↗

Check that request() respects the configured block size.

(self)

Source from the content-addressed store, hash-verified

1100 self.assertEqual(sock.data, expected)
1101
1102 def test_blocksize_request(self):
1103 """Check that request() respects the configured block size."""
1104 blocksize = 8 # For easy debugging.
1105 conn = client.HTTPConnection('example.com', blocksize=blocksize)
1106 sock = FakeSocket(None)
1107 conn.sock = sock
1108 expected = b"a" * blocksize + b"b"
1109 conn.request("PUT", "/", io.BytesIO(expected), {"Content-Length": "9"})
1110 self.assertEqual(sock.sendall_calls, 3)
1111 body = sock.data.split(b"\r\n\r\n", 1)[1]
1112 self.assertEqual(body, expected)
1113
1114 def test_blocksize_send(self):
1115 """Check that send() respects the configured block size."""

Callers

nothing calls this directly

Calls 4

requestMethod · 0.95
FakeSocketClass · 0.70
assertEqualMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected