mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
asyncio: Improve default writelines().
This commit is contained in:
parent
afbf827875
commit
f10345e102
2 changed files with 20 additions and 6 deletions
|
@ -24,12 +24,18 @@ class TransportTests(unittest.TestCase):
|
|||
transport = transports.Transport()
|
||||
transport.write = unittest.mock.Mock()
|
||||
|
||||
transport.writelines(['line1', 'line2', 'line3'])
|
||||
self.assertEqual(3, transport.write.call_count)
|
||||
transport.writelines([b'line1',
|
||||
bytearray(b'line2'),
|
||||
memoryview(b'line3')])
|
||||
self.assertEqual(1, transport.write.call_count)
|
||||
transport.write.assert_called_with(b'line1line2line3')
|
||||
|
||||
def test_not_implemented(self):
|
||||
transport = transports.Transport()
|
||||
|
||||
self.assertRaises(NotImplementedError,
|
||||
transport.set_write_buffer_limits)
|
||||
self.assertRaises(NotImplementedError, transport.get_write_buffer_size)
|
||||
self.assertRaises(NotImplementedError, transport.write, 'data')
|
||||
self.assertRaises(NotImplementedError, transport.write_eof)
|
||||
self.assertRaises(NotImplementedError, transport.can_write_eof)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue