summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-116417: Move limited C API abstract.c tests to _testlimitedcapi (#116986)Victor Stinner2024-03-191-8/+8
| | | | | | | Split abstract.c and float.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi. Update test_bytes and test_class.
* gh-115323: Add meaningful error message for using bytearray.extend with str ↵Jay Ting2024-02-241-0/+7
| | | | | | | | (#115332) Perform str check after TypeError is raised --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* gh-104231: Add more tests for str(), repr(), ascii(), and bytes() (GH-112551)Serhiy Storchaka2023-11-301-22/+59
|
* gh-107178: Add the C API tests for the Abstract Objects Layer (GH-107179)Serhiy Storchaka2023-08-071-1/+1
| | | | | | | | | | Cover all the Mapping Protocol, almost all the Sequence Protocol (except PySequence_Fast) and a part of the Object Protocol. Move existing tests to Lib/test/test_capi/test_abstract.py and Modules/_testcapi/abstract.c. Add also tests for PyDict C API.
* gh-94808: Add coverage for bytesarray_setitem (#95802)Michael Droettboom2022-10-101-41/+70
|
* gh-94808: Improve coverage of _PyBytes_FormatEx (GH-95895)Michael Droettboom2022-09-071-0/+18
| | | | | | | | There were two specific areas not covered: - %(name) syntax - %*s syntax Automerge-Triggered-By: GH:iritkatriel
* GH-91153: Handle mutating __index__ methods in bytearray item assignment ↵Brandt Bucher2022-07-191-0/+17
| | | | (GH-94891)
* bpo-26579: Add object.__getstate__(). (GH-2821)Serhiy Storchaka2022-04-061-6/+14
| | | | | | | Copying and pickling instances of subclasses of builtin types bytearray, set, frozenset, collections.OrderedDict, collections.deque, weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes implemented as slots.
* bpo-45668: Fix PGO tests without test extensions (GH-29315)Christian Heimes2021-11-011-2/+2
|
* Fix bytes.__bytes__ to not truncate at a zero byte (GH-27902)Mark Dickinson2021-08-231-2/+2
|
* bpo-24234: Implement bytes.__bytes__ (GH-27901)Dong-hee Na2021-08-231-0/+12
|
* bpo-44891: Tests `id` preserving on `* 1` for `str` and `bytes` (GH-27745)Nikita Sobolev2021-08-131-0/+22
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208)Tobias Holl2021-01-131-0/+10
| | | | Before, using the * operator to repeat a bytearray would copy data from the start of the internal buffer (ob_bytes) and not from the start of the actual data (ob_start).
* bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)Ronald Oussoren2020-11-081-0/+1
| | | | | | | | | | | Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
* bpo-40275: Use new test.support helper submodules in tests (GH-21772)Hai Shi2020-08-071-2/+3
|
* bpo-40275: Use new test.support helper submodules in tests (GH-21315)Hai Shi2020-07-061-3/+4
|
* bpo-36051: Drop GIL during large bytes.join() (GH-17757)Bruce Merry2020-01-291-2/+6
| | | | | Improve multi-threaded performance by dropping the GIL in the fast path of bytes.join. To avoid increasing overhead for small joins, it is only done if the output size exceeds a threshold.
* bpo-37840: Fix handling of negative indices in bytearray_getitem() (GH-15250)Sergey Fedoseev2019-09-091-0/+9
|
* bpo-37388: Development mode check encoding and errors (GH-14341)Victor Stinner2019-06-251-0/+58
| | | | | | | | | In development mode and in debug build, encoding and errors arguments are now checked on string encoding and decoding operations. Examples: open(), str.encode() and bytes.decode(). By default, for best performances, the errors argument is only checked at the first encoding/decoding error, and the encoding argument is sometimes ignored for empty strings.
* bpo-22385: Support output separators in hex methods. (#13578)Gregory P. Smith2019-05-291-0/+57
| | | | | | | | | | | | | | | | | | * bpo-22385: Support output separators in hex methods. Also in binascii.hexlify aka b2a_hex. The underlying implementation behind all hex generation in CPython uses the same pystrhex.c implementation. This adds support to bytes, bytearray, and memoryview objects. The binascii module functions exist rather than being slated for deprecation because they return bytes rather than requiring an intermediate step through a str object. This change was inspired by MicroPython which supports sep in its binascii implementation (and does not yet support the .hex methods). https://bugs.python.org/issue22385
* bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)Zackery Spytz2019-05-171-2/+3
| | | | | | | The final addition (cur += step) may overflow, so use size_t for "cur". "cur" is always positive (even for negative steps), so it is safe to use size_t here. Co-Authored-By: Martin Panter <vadmium+py@gmail.com>
* Fix syntax warnings in tests introduced in bpo-15248. (GH-11932)Serhiy Storchaka2019-02-191-3/+5
|
* bpo-33817: Fix _PyBytes_Resize() for empty bytes object. (GH-11516)Serhiy Storchaka2019-01-121-0/+6
| | | | Add also tests for PyUnicode_FromFormat() and PyBytes_FromFormat() with empty result.
* bpo-34984: Improve error messages for bytes and bytearray constructors. ↵Serhiy Storchaka2018-10-211-0/+2
| | | | (GH-9874)
* bpo-34973: Fix crash in bytes constructor. (GH-9841)Serhiy Storchaka2018-10-211-0/+17
| | | Constructing bytes from mutating list could cause a crash.
* bpo-34974: Do not replace unexpected errors in bytes() and bytearray(). ↵Serhiy Storchaka2018-10-141-2/+16
| | | | | | | (GH-9852) bytes and bytearray constructors converted unexpected exceptions (e.g. MemoryError and KeyboardInterrupt) to TypeError.
* Add new tests for bytes and bytearray constructors. (GH-9843)Serhiy Storchaka2018-10-131-3/+43
| | | | Covered all special cases: bytes, tuple, list, differend kinds of iterables and iterators.
* bpo-20047: Make bytearray methods partition() and rpartition() rejecting (#4158)Serhiy Storchaka2017-10-281-6/+29
| | | separators that are not bytes-like objects.
* bpo-20552: Use specific asserts in bytes tests (#790)Serhiy Storchaka2017-03-271-15/+15
|
* bpo-29714: Fix a regression that bytes format may fail when containing zero ↵Xiang Zhang2017-03-061-0/+10
| | | | bytes inside. (GH-499)
* Merge 3.6INADA Naoki2017-01-061-0/+13
|\
| * Issue #29159: Fix regression in bytes(x) when x.__index__() raises Exception.INADA Naoki2017-01-061-0/+13
| |
* | Issue #28927: bytes.fromhex() and bytearray.fromhex() now ignore all ASCIISerhiy Storchaka2016-12-191-0/+8
|/ | | | whitespace, not only spaces. Patch by Robert Xiao.
* Issue #28385: An error message when non-empty format spec is passed toSerhiy Storchaka2016-10-301-0/+9
|\ | | | | | | object.__format__ now contains the name of actual type.
| * Issue #28385: An error message when non-empty format spec is passed toSerhiy Storchaka2016-10-301-0/+9
| | | | | | | | object.__format__ now contains the name of actual type.
* | Remove old typo.Serhiy Storchaka2016-09-081-1/+1
| | | | | | | | | | Initially (e0b7e34b5971) it should be \udef0, but after 52a77ef069cd (issue #3672) lone surrogates are not accepted and should be removed.
* | Issue #27506: Support bytes/bytearray.translate() delete as keyword argumentMartin Panter2016-08-271-18/+31
| | | | | | | | Patch by Xiang Zhang.
* | Anti-registration of various ABC methods.Guido van Rossum2016-08-181-0/+30
| | | | | | | | | | | | | | | | | | | | - Issue #25958: Support "anti-registration" of special methods from various ABCs, like __hash__, __iter__ or __len__. All these (and several more) can be set to None in an implementation class and the behavior will be as if the method is not defined at all. (Previously, this mechanism existed only for __hash__, to make mutable classes unhashable.) Code contributed by Andrew Barnert and Ivan Levkivskyi.
* | Issue #27474: Unified error messages in the __contains__ method of bytes andSerhiy Storchaka2016-07-101-0/+1
| | | | | | | | | | bytearray for integers in and out of the Py_ssize_t range. Patch by Xiang Zhang.
* | Issue #27443: __length_hint__() of bytearray itearator no longer returnSerhiy Storchaka2016-07-031-0/+10
|\ \ | |/ | | | | negative integer for resized bytearray.
| * Issue #27443: __length_hint__() of bytearray itearator no longer returnSerhiy Storchaka2016-07-031-0/+10
| | | | | | | | negative integer for resized bytearray.
* | Issue #27007: The fromhex() class methods of bytes and bytearray subclassesSerhiy Storchaka2016-07-011-1/+26
| | | | | | | | now return an instance of corresponding subclass.
* | Issue #27039: Fixed bytearray.remove() for values greater than 127.Serhiy Storchaka2016-05-161-0/+7
|\ \ | |/ | | | | Based on patch by Joe Jevnik.
| * Issue #27039: Fixed bytearray.remove() for values greater than 127.Serhiy Storchaka2016-05-161-0/+7
| | | | | | | | Patch by Joe Jevnik.
* | Make bytes and bytearray subclass tests compatible with base types tests.Serhiy Storchaka2016-05-121-15/+17
|\ \ | |/
| * Make bytes and bytearray subclass tests compatible with base types tests.Serhiy Storchaka2016-05-121-15/+17
| |
| * Issue #26764: Bacported tests for bytes formatting.Serhiy Storchaka2016-04-151-26/+11
| |
* | Issue #26766: Fix _PyBytesWriter_Finish()Victor Stinner2016-04-151-2/+2
| | | | | | | | | | | | | | Return a bytearray object when bytearray is requested and when the small buffer is used. Fix also test_bytes: bytearray%args must return a bytearray type.
* | Issue #26764: Fixed SystemError in bytes.__rmod__.Serhiy Storchaka2016-04-151-26/+11
| |
* | Issue #26712: Merge string_tests cleanup from 3.5Martin Panter2016-04-101-87/+4
|\ \ | |/