Issue 7625: bytearray needs more tests for "b.some_method()[0] is not b" (original) (raw)

Issue7625

Created on 2010-01-03 20:04 by flox, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue7625_tests.diff flox,2010-01-04 08:01 Patch, apply to trunk
Messages (4)
msg97176 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-03 20:04
There's not enough tests to verify such cases: - b.split()[0] is not b - b.rsplit()[0] is not b - b.splitlines()[0] is not b - b.partition('.')[0] is not b - b.rpartition('.')[0] is not b - (other ?) However similar tests exist in Lib/test/test_bytes: * ByteArrayTest.test_copied() -> some tests for ('replace', 'translate') * ByteArrayTest.test_partition_bytearray_doesnt_share_nullstring -> some tests for ('partition', 'rpartition') * BytearrayPEP3137Test.test_returns_new_copy() -> some tests for ('zfill', 'rjust', 'ljust', 'center')
msg97178 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-03 20:28
And each test comes with a new bug :) >>> x = bytearray('abc') >>> x.partition('.')[0] is x True >>> x.rpartition('.')[2] is x True
msg97195 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2010-01-04 08:01
Patch for some additional test cases attached. The bug "b.partition('.')[0] is b" is fixed with the patch proposed on .
msg97723 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-01-13 15:04
Committed in trunk (r77475) and py3k (r77476). Thank you.
History
Date User Action Args
2022-04-11 14:56:56 admin set github: 51874
2010-01-13 15:04:01 pitrou set status: open -> closedversions: - Python 2.6, Python 3.1nosy: + pitroumessages: + resolution: fixed
2010-01-04 08:01:27 flox set files: + issue7625_tests.diffkeywords: + patchmessages: +
2010-01-03 21:47:39 ezio.melotti set nosy: + ezio.melotti
2010-01-03 20:36:37 flox set components: + Interpreter Coreversions: + Python 2.6, Python 3.1, Python 3.2
2010-01-03 20:28:46 flox set priority: low -> normalmessages: +
2010-01-03 20:04:27 flox create