Compare commits

..

No commits in common. "e1c669b7ed18a81bfaa349726424ff5de9485f0a" and "01fcde89d7d56321078be1739e759fece61d0a2b" have entirely different histories.

4 changed files with 5 additions and 10 deletions

View File

@ -78,7 +78,7 @@ objects:
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:
Sort the items of the list in place (the arguments can be used for sort

View File

@ -34,9 +34,8 @@ class IncompleteReadError(EOFError):
- expected: total number of expected bytes (or None if unknown)
"""
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 '
f'{r_expected} expected bytes')
f'{expected!r} expected bytes')
self.partial = partial
self.expected = expected

View File

@ -452,14 +452,12 @@ class StreamTests(test_utils.TestCase):
def test_readuntil_eof(self):
stream = asyncio.StreamReader(loop=self.loop)
data = b'some dataAA'
stream.feed_data(data)
stream.feed_data(b'some dataAA')
stream.feed_eof()
with self.assertRaisesRegex(asyncio.IncompleteReadError,
'undefined expected bytes') as cm:
with self.assertRaises(asyncio.IncompleteReadError) as cm:
self.loop.run_until_complete(stream.readuntil(b'AAA'))
self.assertEqual(cm.exception.partial, data)
self.assertEqual(cm.exception.partial, b'some dataAA')
self.assertIsNone(cm.exception.expected)
self.assertEqual(b'', stream._buffer)

View File

@ -1,2 +0,0 @@
Clarify the error message for :exc:`asyncio.IncompleteReadError` when
``expected`` is ``None``.