Message262943
I discovered a flaw in the bytearray tests: most of them don’t actually test bytearray objects! This is easy to fix in Python 3, and I added a test case to ensure that the arguments are converted to the expected type.
However porting this fix to Python 2 was trickier. A few of the bytearray methods do not accept bytearray arguments:
>>> bytearray(b"abc").ljust(10, bytearray(b"*"))
TypeError: ljust() argument 2 must be char, not bytearray
>>> bytearray(b"abc").rjust(10, bytearray(b"*"))
TypeError: rjust() argument 2 must be char, not bytearray
>>> bytearray(b"abc").center(10, bytearray(b"*"))
TypeError: center() argument 2 must be char, not bytearray
I adapted the tests from the deleted buffer_tests.py file to override the relevant tests from string_tests.py, so that we continue to test bytearray methods but with str a.k.a. bytes arguments. |
|
Date |
User |
Action |
Args |
2016-04-06 12:12:40 | martin.panter | set | recipients:
+ martin.panter, ezio.melotti, serhiy.storchaka |
2016-04-06 12:12:39 | martin.panter | set | messageid: <1459944759.96.0.887547330933.issue26257@psf.upfronthosting.co.za> |
2016-04-06 12:12:39 | martin.panter | link | issue26257 messages |
2016-04-06 12:12:39 | martin.panter | create | |
|