MCPcopy Create free account
hub / github.com/python/cpython / test_wait_closed_on_close

Method test_wait_closed_on_close

Lib/test/test_asyncio/test_streams.py:1033–1048  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1031 self.assertEqual(e.consumed, e2.consumed)
1032
1033 def test_wait_closed_on_close(self):
1034 with test_utils.run_test_server() as httpd:
1035 rd, wr = self.loop.run_until_complete(
1036 asyncio.open_connection(*httpd.address))
1037
1038 wr.write(b'GET / HTTP/1.0\r\n\r\n')
1039 f = rd.readline()
1040 data = self.loop.run_until_complete(f)
1041 self.assertEqual(data, b'HTTP/1.0 200 OK\r\n')
1042 f = rd.read()
1043 data = self.loop.run_until_complete(f)
1044 self.assertEndsWith(data, b'\r\n\r\nTest message')
1045 self.assertFalse(wr.is_closing())
1046 wr.close()
1047 self.assertTrue(wr.is_closing())
1048 self.loop.run_until_complete(wr.wait_closed())
1049
1050 def test_wait_closed_on_close_with_unread_data(self):
1051 with test_utils.run_test_server() as httpd:

Callers

nothing calls this directly

Calls 11

assertEndsWithMethod · 0.80
assertFalseMethod · 0.80
assertTrueMethod · 0.80
run_until_completeMethod · 0.45
writeMethod · 0.45
readlineMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45
is_closingMethod · 0.45
closeMethod · 0.45
wait_closedMethod · 0.45

Tested by

no test coverage detected