[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 9eb35ab0d7)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
Andrew Svetlov 2019-09-13 16:14:55 +03:00 committed by GitHub
parent 4556b1d35c
commit 6638c92260
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View file

@ -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()