mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #8990: array.fromstring() and array.tostring() get renamed to
frombytes() and tobytes(), respectively, to avoid confusion. Furthermore, array.frombytes(), array.extend() as well as the array.array() constructor now accept bytearray objects. Patch by Thomas Jollans.
This commit is contained in:
parent
42cb462682
commit
1ce3eb5c5b
12 changed files with 167 additions and 48 deletions
|
@ -44,7 +44,7 @@ class AutoFileTests(unittest.TestCase):
|
|||
a = array('b', b'x'*10)
|
||||
self.f = self.open(TESTFN, 'rb')
|
||||
n = self.f.readinto(a)
|
||||
self.assertEquals(b'12', a.tostring()[:n])
|
||||
self.assertEquals(b'12', a.tobytes()[:n])
|
||||
|
||||
def testReadinto_text(self):
|
||||
# verify readinto refuses text files
|
||||
|
@ -281,7 +281,7 @@ class OtherFileTests(unittest.TestCase):
|
|||
except ValueError:
|
||||
self.fail("readinto() after next() with supposedly empty "
|
||||
"iteration-buffer failed anyway")
|
||||
line = buf.tostring()
|
||||
line = buf.tobytes()
|
||||
if line != testline:
|
||||
self.fail("readinto() after next() with empty buffer "
|
||||
"failed. Got %r, expected %r" % (line, testline))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue