summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2019-09-13 13:14:55 (GMT)
committerGitHub <noreply@github.com>2019-09-13 13:14:55 (GMT)
commit6638c9226066205a646e18da95b33e619d784b0b (patch)
treefd8b1e83046f215cea16a7104345c2ad9dd63411 /Lib/test/test_asyncio
parent4556b1d35c352c975f3cf066362cb6e24efe0668 (diff)
downloadcpython-6638c9226066205a646e18da95b33e619d784b0b.zip
cpython-6638c9226066205a646e18da95b33e619d784b0b.tar.gz
cpython-6638c9226066205a646e18da95b33e619d784b0b.tar.bz2
[3.8] bpo-38148: Add slots to asyncio transports (GH-16077) (GH-16093)
* bpo-38148: Add slots to asyncio transports * Update Misc/NEWS.d/next/Library/2019-09-13-08-55-43.bpo-38148.Lnww6D.rst Co-Authored-By: Kyle Stanley <aeros167@gmail.com> (cherry picked from commit 9eb35ab0d71a6bd680e84fa0f828cb634e72b681) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_transports.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_asyncio/test_transports.py b/Lib/test/test_asyncio/test_transports.py
index 7de9b3e..df44855 100644
--- a/Lib/test/test_asyncio/test_transports.py
+++ b/Lib/test/test_asyncio/test_transports.py
@@ -22,14 +22,19 @@ class TransportTests(unittest.TestCase):
self.assertIs(default, transport.get_extra_info('unknown', default))
def test_writelines(self):
- transport = asyncio.Transport()
- transport.write = mock.Mock()
+ writer = mock.Mock()
+
+ class MyTransport(asyncio.Transport):
+ def write(self, data):
+ writer(data)
+
+ transport = MyTransport()
transport.writelines([b'line1',
bytearray(b'line2'),
memoryview(b'line3')])
- self.assertEqual(1, transport.write.call_count)
- transport.write.assert_called_with(b'line1line2line3')
+ self.assertEqual(1, writer.call_count)
+ writer.assert_called_with(b'line1line2line3')
def test_not_implemented(self):
transport = asyncio.Transport()