Compare commits
3 Commits
e4fe303b8c
...
d41ec65ab7
Author | SHA1 | Date |
---|---|---|
Zackery Spytz | d41ec65ab7 | |
Zackery Spytz | 8085f742f4 | |
Wansoo Kim | 5b0194ed31 |
|
@ -78,7 +78,7 @@ objects:
|
||||||
Return the number of times *x* appears in the list.
|
Return the number of times *x* appears in the list.
|
||||||
|
|
||||||
|
|
||||||
.. method:: list.sort(key=None, reverse=False)
|
.. method:: list.sort(*, key=None, reverse=False)
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
Sort the items of the list in place (the arguments can be used for sort
|
Sort the items of the list in place (the arguments can be used for sort
|
||||||
|
|
|
@ -34,8 +34,9 @@ class IncompleteReadError(EOFError):
|
||||||
- expected: total number of expected bytes (or None if unknown)
|
- expected: total number of expected bytes (or None if unknown)
|
||||||
"""
|
"""
|
||||||
def __init__(self, partial, expected):
|
def __init__(self, partial, expected):
|
||||||
|
r_expected = 'undefined' if expected is None else repr(expected)
|
||||||
super().__init__(f'{len(partial)} bytes read on a total of '
|
super().__init__(f'{len(partial)} bytes read on a total of '
|
||||||
f'{expected!r} expected bytes')
|
f'{r_expected} expected bytes')
|
||||||
self.partial = partial
|
self.partial = partial
|
||||||
self.expected = expected
|
self.expected = expected
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ class Future:
|
||||||
|
|
||||||
@_log_traceback.setter
|
@_log_traceback.setter
|
||||||
def _log_traceback(self, val):
|
def _log_traceback(self, val):
|
||||||
if bool(val):
|
if val:
|
||||||
raise ValueError('_log_traceback can only be set to False')
|
raise ValueError('_log_traceback can only be set to False')
|
||||||
self.__log_traceback = False
|
self.__log_traceback = False
|
||||||
|
|
||||||
|
|
|
@ -444,12 +444,14 @@ class StreamTests(test_utils.TestCase):
|
||||||
|
|
||||||
def test_readuntil_eof(self):
|
def test_readuntil_eof(self):
|
||||||
stream = asyncio.StreamReader(loop=self.loop)
|
stream = asyncio.StreamReader(loop=self.loop)
|
||||||
stream.feed_data(b'some dataAA')
|
data = b'some dataAA'
|
||||||
|
stream.feed_data(data)
|
||||||
stream.feed_eof()
|
stream.feed_eof()
|
||||||
|
|
||||||
with self.assertRaises(asyncio.IncompleteReadError) as cm:
|
with self.assertRaisesRegex(asyncio.IncompleteReadError,
|
||||||
|
'undefined expected bytes') as cm:
|
||||||
self.loop.run_until_complete(stream.readuntil(b'AAA'))
|
self.loop.run_until_complete(stream.readuntil(b'AAA'))
|
||||||
self.assertEqual(cm.exception.partial, b'some dataAA')
|
self.assertEqual(cm.exception.partial, data)
|
||||||
self.assertIsNone(cm.exception.expected)
|
self.assertIsNone(cm.exception.expected)
|
||||||
self.assertEqual(b'', stream._buffer)
|
self.assertEqual(b'', stream._buffer)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Clarify the error message for :exc:`asyncio.IncompleteReadError` when
|
||||||
|
``expected`` is ``None``.
|
Loading…
Reference in New Issue