mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -430,12 +430,12 @@ class StructTest(unittest.TestCase):
|
|||
|
||||
# Test without offset
|
||||
s.pack_into(writable_buf, 0, test_string)
|
||||
from_buf = writable_buf.tostring()[:len(test_string)]
|
||||
from_buf = writable_buf.tobytes()[:len(test_string)]
|
||||
self.assertEqual(from_buf, test_string)
|
||||
|
||||
# Test with offset.
|
||||
s.pack_into(writable_buf, 10, test_string)
|
||||
from_buf = writable_buf.tostring()[:len(test_string)+10]
|
||||
from_buf = writable_buf.tobytes()[:len(test_string)+10]
|
||||
self.assertEqual(from_buf, test_string[:10] + test_string)
|
||||
|
||||
# Go beyond boundaries.
|
||||
|
@ -458,12 +458,12 @@ class StructTest(unittest.TestCase):
|
|||
|
||||
# Test without offset.
|
||||
pack_into(writable_buf, 0, test_string)
|
||||
from_buf = writable_buf.tostring()[:len(test_string)]
|
||||
from_buf = writable_buf.tobytes()[:len(test_string)]
|
||||
self.assertEqual(from_buf, test_string)
|
||||
|
||||
# Test with offset.
|
||||
pack_into(writable_buf, 10, test_string)
|
||||
from_buf = writable_buf.tostring()[:len(test_string)+10]
|
||||
from_buf = writable_buf.tobytes()[:len(test_string)+10]
|
||||
self.assertEqual(from_buf, test_string[:10] + test_string)
|
||||
|
||||
# Go beyond boundaries.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue