This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients ezio.melotti, martin.panter, serhiy.storchaka
Date 2016-04-06.12:12:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1459944759.96.0.887547330933.issue26257@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-04-06 12:12:40martin.pantersetrecipients: + martin.panter, ezio.melotti, serhiy.storchaka
2016-04-06 12:12:39martin.pantersetmessageid: <1459944759.96.0.887547330933.issue26257@psf.upfronthosting.co.za>
2016-04-06 12:12:39martin.panterlinkissue26257 messages
2016-04-06 12:12:39martin.pantercreate