diff options
author | Guido van Rossum <guido@python.org> | 2013-12-04 20:12:07 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2013-12-04 20:12:07 (GMT) |
commit | ebb8e58f0ab66a9d124580e4a1d5b0d5499b0a4d (patch) | |
tree | f602167fd70427162ffa575fac0a63ad7ad1c036 /Lib/test | |
parent | 638aebd58e16a686ea8641f94ca714c406df1792 (diff) | |
download | cpython-ebb8e58f0ab66a9d124580e4a1d5b0d5499b0a4d.zip cpython-ebb8e58f0ab66a9d124580e4a1d5b0d5499b0a4d.tar.gz cpython-ebb8e58f0ab66a9d124580e4a1d5b0d5499b0a4d.tar.bz2 |
asyncio: Write flow control for proactor event loop.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_proactor_events.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py index 5a2a51c..9964f42 100644 --- a/Lib/test/test_asyncio/test_proactor_events.py +++ b/Lib/test/test_asyncio/test_proactor_events.py @@ -111,8 +111,8 @@ class ProactorSocketTransportTests(unittest.TestCase): tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol) tr._loop_writing = unittest.mock.Mock() tr.write(b'data') - self.assertEqual(tr._buffer, [b'data']) - self.assertTrue(tr._loop_writing.called) + self.assertEqual(tr._buffer, None) + tr._loop_writing.assert_called_with(data=b'data') def test_write_no_data(self): tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol) @@ -124,12 +124,12 @@ class ProactorSocketTransportTests(unittest.TestCase): tr._write_fut = unittest.mock.Mock() tr._loop_writing = unittest.mock.Mock() tr.write(b'data') - self.assertEqual(tr._buffer, [b'data']) + self.assertEqual(tr._buffer, b'data') self.assertFalse(tr._loop_writing.called) def test_loop_writing(self): tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol) - tr._buffer = [b'da', b'ta'] + tr._buffer = bytearray(b'data') tr._loop_writing() self.loop._proactor.send.assert_called_with(self.sock, b'data') self.loop._proactor.send.return_value.add_done_callback.\ @@ -150,7 +150,7 @@ class ProactorSocketTransportTests(unittest.TestCase): tr.write(b'data') tr.write(b'data') tr.write(b'data') - self.assertEqual(tr._buffer, []) + self.assertEqual(tr._buffer, None) m_log.warning.assert_called_with('socket.send() raised exception.') def test_loop_writing_stop(self): @@ -226,7 +226,7 @@ class ProactorSocketTransportTests(unittest.TestCase): write_fut.cancel.assert_called_with() test_utils.run_briefly(self.loop) self.protocol.connection_lost.assert_called_with(None) - self.assertEqual([], tr._buffer) + self.assertEqual(None, tr._buffer) self.assertEqual(tr._conn_lost, 1) def test_force_close_idempotent(self): @@ -243,7 +243,7 @@ class ProactorSocketTransportTests(unittest.TestCase): test_utils.run_briefly(self.loop) self.protocol.connection_lost.assert_called_with(None) - self.assertEqual([], tr._buffer) + self.assertEqual(None, tr._buffer) def test_call_connection_lost(self): tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol) |