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

Method test_recv_into_buffer_protocol_len

Lib/test/test_ssl.py:3994–4013  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3992 self.assertEqual(s.recv_into(bytearray()), 0)
3993
3994 def test_recv_into_buffer_protocol_len(self):
3995 server = ThreadedEchoServer(CERTFILE)
3996 self.enterContext(server)
3997 s = socket.create_connection((HOST, server.port))
3998 self.addCleanup(s.close)
3999 s = test_wrap_socket(s, suppress_ragged_eofs=False)
4000 self.addCleanup(s.close)
4001
4002 s.send(b"data")
4003 buf = array.array('I', [0, 0])
4004 self.assertEqual(s.recv_into(buf), 4)
4005 self.assertEqual(bytes(buf)[:4], b"data")
4006
4007 class B(bytearray):
4008 def __len__(self):
4009 1/0
4010 s.send(b"data")
4011 buf = B(6)
4012 self.assertEqual(s.recv_into(buf), 4)
4013 self.assertEqual(bytes(buf), b"data\0\0")
4014
4015 def test_nonblocking_send(self):
4016 server = ThreadedEchoServer(CERTFILE,

Callers

nothing calls this directly

Calls 9

ThreadedEchoServerClass · 0.85
test_wrap_socketFunction · 0.85
enterContextMethod · 0.80
addCleanupMethod · 0.80
BClass · 0.70
create_connectionMethod · 0.45
sendMethod · 0.45
assertEqualMethod · 0.45
recv_intoMethod · 0.45

Tested by

no test coverage detected