MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_blocksize_request

Method test_blocksize_request

Lib/test/test_httplib.py:1056–1066  ·  view source on GitHub ↗

Check that request() respects the configured block size.

(self)

Source from the content-addressed store, hash-verified

1054 self.assertEqual(sock.data, expected)
1055
1056 def test_blocksize_request(self):
1057 """Check that request() respects the configured block size."""
1058 blocksize = 8 # For easy debugging.
1059 conn = client.HTTPConnection('example.com', blocksize=blocksize)
1060 sock = FakeSocket(None)
1061 conn.sock = sock
1062 expected = b"a" * blocksize + b"b"
1063 conn.request("PUT", "/", io.BytesIO(expected), {"Content-Length": "9"})
1064 self.assertEqual(sock.sendall_calls, 3)
1065 body = sock.data.split(b"\r\n\r\n", 1)[1]
1066 self.assertEqual(body, expected)
1067
1068 def test_blocksize_send(self):
1069 """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