mirror of
https://github.com/python/cpython.git
synced 2025-08-15 14:20:55 +00:00
[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:
parent
4556b1d35c
commit
6638c92260
3 changed files with 24 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue