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

Method test_basics

Lib/test/test_socketserver.py:392–407  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

390
391class SocketWriterTest(unittest.TestCase):
392 def test_basics(self):
393 class Handler(socketserver.StreamRequestHandler):
394 def handle(self):
395 self.server.wfile = self.wfile
396 self.server.wfile_fileno = self.wfile.fileno()
397 self.server.request_fileno = self.request.fileno()
398
399 server = socketserver.TCPServer((HOST, 0), Handler)
400 self.addCleanup(server.server_close)
401 s = socket.socket(
402 server.address_family, socket.SOCK_STREAM, socket.IPPROTO_TCP)
403 with s:
404 s.connect(server.server_address)
405 server.handle_request()
406 self.assertIsInstance(server.wfile, io.BufferedIOBase)
407 self.assertEqual(server.wfile_fileno, server.request_fileno)
408
409 def test_write(self):
410 # Test that wfile.write() sends data immediately, and that it does

Callers

nothing calls this directly

Calls 6

addCleanupMethod · 0.80
socketMethod · 0.80
assertIsInstanceMethod · 0.80
connectMethod · 0.45
handle_requestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected