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

Method _basetest_open_connection

Lib/test/test_asyncio/test_streams.py:40–52  ·  view source on GitHub ↗
(self, open_connection_fut)

Source from the content-addressed store, hash-verified

38 super().tearDown()
39
40 def _basetest_open_connection(self, open_connection_fut):
41 messages = []
42 self.loop.set_exception_handler(lambda loop, ctx: messages.append(ctx))
43 reader, writer = self.loop.run_until_complete(open_connection_fut)
44 writer.write(b'GET / HTTP/1.0\r\n\r\n')
45 f = reader.readline()
46 data = self.loop.run_until_complete(f)
47 self.assertEqual(data, b'HTTP/1.0 200 OK\r\n')
48 f = reader.read()
49 data = self.loop.run_until_complete(f)
50 self.assertEndsWith(data, b'\r\n\r\nTest message')
51 writer.close()
52 self.assertEqual(messages, [])
53
54 def test_open_connection(self):
55 with test_utils.run_test_server() as httpd:

Callers 2

test_open_connectionMethod · 0.95

Calls 9

assertEndsWithMethod · 0.80
set_exception_handlerMethod · 0.45
appendMethod · 0.45
run_until_completeMethod · 0.45
writeMethod · 0.45
readlineMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected