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

Method test_asyncore_server

Lib/test/test_ssl.py:3810–3837  ·  view source on GitHub ↗

Check the example asyncore integration.

(self)

Source from the content-addressed store, hash-verified

3808 self.assertEqual(d1, d2)
3809
3810 def test_asyncore_server(self):
3811 """Check the example asyncore integration."""
3812 if support.verbose:
3813 sys.stdout.write("\n")
3814
3815 indata = b"FOO\n"
3816 server = AsyncoreEchoServer(CERTFILE)
3817 with server:
3818 s = test_wrap_socket(socket.socket())
3819 s.connect(('127.0.0.1', server.port))
3820 if support.verbose:
3821 sys.stdout.write(
3822 " client: sending %r...\n" % indata)
3823 s.write(indata)
3824 outdata = s.read()
3825 if support.verbose:
3826 sys.stdout.write(" client: read %r\n" % outdata)
3827 if outdata != indata.lower():
3828 self.fail(
3829 "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n"
3830 % (outdata[:20], len(outdata),
3831 indata[:20].lower(), len(indata)))
3832 s.write(b"over\n")
3833 if support.verbose:
3834 sys.stdout.write(" client: closing connection.\n")
3835 s.close()
3836 if support.verbose:
3837 sys.stdout.write(" client: connection closed.\n")
3838
3839 def test_recv_send(self):
3840 """Test recv(), send() and friends."""

Callers

nothing calls this directly

Calls 9

AsyncoreEchoServerClass · 0.85
test_wrap_socketFunction · 0.85
socketMethod · 0.80
writeMethod · 0.45
connectMethod · 0.45
readMethod · 0.45
lowerMethod · 0.45
failMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected