Browse Source

asyncio: Sync with github

pull/40/head
Yury Selivanov 10 years ago
parent
commit
dddc781998
  1. 3
      Lib/asyncio/streams.py
  2. 4
      Lib/test/test_asyncio/test_streams.py

3
Lib/asyncio/streams.py

@ -494,6 +494,9 @@ class StreamReader:
@coroutine
def readexactly(self, n):
if n < 0:
raise ValueError('readexactly size can not be less than zero')
if self._exception is not None:
raise self._exception

4
Lib/test/test_asyncio/test_streams.py

@ -351,8 +351,8 @@ class StreamReaderTests(test_utils.TestCase):
self.assertEqual(b'', data)
self.assertEqual(self.DATA, stream._buffer)
data = self.loop.run_until_complete(stream.readexactly(-1))
self.assertEqual(b'', data)
with self.assertRaisesRegexp(ValueError, 'less than zero'):
self.loop.run_until_complete(stream.readexactly(-1))
self.assertEqual(self.DATA, stream._buffer)
def test_readexactly(self):

Loading…
Cancel
Save