[Python-checkins] cpython (merge 3.4 -> 3.5): Merge 3.4

yury.selivanov python-checkins at python.org
Fri Dec 11 11:33:26 EST 2015


https://hg.python.org/cpython/rev/4cd2d977a980
changeset: 99527:4cd2d977a980
branch: 3.5
parent: 99523:fe844253cd44
parent: 99526:36cd67ed9d4a
user: Yury Selivanov <yselivanov at sprymix.com>
date: Fri Dec 11 11:33:08 2015 -0500
summary:
 Merge 3.4
files:
 Lib/asyncio/streams.py | 3 +++
 Lib/test/test_asyncio/test_streams.py | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -494,6 +494,9 @@
 
 @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
 
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -351,8 +351,8 @@
 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):
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /