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

Method test_asyncore_server

Lib/test/test_ssl.py:3527–3554  ·  view source on GitHub ↗

Check the example asyncore integration.

(self)

Source from the content-addressed store, hash-verified

3525 self.assertEqual(d1, d2)
3526
3527 def test_asyncore_server(self):
3528 """Check the example asyncore integration."""
3529 if support.verbose:
3530 sys.stdout.write("\n")
3531
3532 indata = b"FOO\n"
3533 server = AsyncoreEchoServer(CERTFILE)
3534 with server:
3535 s = test_wrap_socket(socket.socket())
3536 s.connect(('127.0.0.1', server.port))
3537 if support.verbose:
3538 sys.stdout.write(
3539 " client: sending %r...\n" % indata)
3540 s.write(indata)
3541 outdata = s.read()
3542 if support.verbose:
3543 sys.stdout.write(" client: read %r\n" % outdata)
3544 if outdata != indata.lower():
3545 self.fail(
3546 "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n"
3547 % (outdata[:20], len(outdata),
3548 indata[:20].lower(), len(indata)))
3549 s.write(b"over\n")
3550 if support.verbose:
3551 sys.stdout.write(" client: closing connection.\n")
3552 s.close()
3553 if support.verbose:
3554 sys.stdout.write(" client: connection closed.\n")
3555
3556 def test_recv_send(self):
3557 """Test recv(), send() and friends."""

Callers

nothing calls this directly

Calls 10

AsyncoreEchoServerClass · 0.85
test_wrap_socketFunction · 0.85
lenFunction · 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