Skip to content

Commit 87e841c

Browse files
authored
Remove more asyncio.open_connection()
1 parent bc21d76 commit 87e841c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Lib/test/test_asyncio/test_streams.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,7 @@ def test_LimitOverrunError_pickleable(self):
944944
class NewStreamTests2(unittest.IsolatedAsyncioTestCase):
945945
async def test_wait_closed_on_close(self):
946946
with test_utils.run_test_server() as httpd:
947-
rd, wr = self.loop.run_until_complete(
948-
asyncio.open_connection(*httpd.address))
947+
rd, wr = await asyncio.open_connection(*httpd.address)
949948

950949
wr.write(b'GET / HTTP/1.0\r\n\r\n')
951950
data = await rd.readline()
@@ -962,8 +961,7 @@ async def test_wait_closed_on_close_with_unread_data(self):
962961
rd, wr = await asyncio.open_connection(*httpd.address)
963962

964963
wr.write(b'GET / HTTP/1.0\r\n\r\n')
965-
f = rd.readline()
966-
data = self.loop.run_until_complete(f)
964+
data = await rd.readline()
967965
self.assertEqual(data, b'HTTP/1.0 200 OK\r\n')
968966
wr.close()
969967
await wr.wait_closed()
@@ -1005,11 +1003,9 @@ async def test_eof_feed_when_closing_writer(self):
10051003
with test_utils.run_test_server() as httpd:
10061004
rd, wr = await asyncio.open_connection(*httpd.address)
10071005
wr.close()
1008-
f = wr.wait_closed()
1009-
self.loop.run_until_complete(f)
1006+
await wr.wait_closed()
10101007
self.assertTrue(rd.at_eof())
1011-
f = rd.read()
1012-
data = self.loop.run_until_complete(f)
1008+
data = await rd.read()
10131009
self.assertEqual(data, b'')
10141010

10151011

0 commit comments

Comments
 (0)