aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_unicode.py
Commit message (Collapse)AuthorAge
* Remove wrong comment about `repr` in `test_unicode` (#100495)Nikita Sobolev2022-12-24
|
* gh-94808: improve test coverage of number formatting (#99472)Nikita Sobolev2022-12-23
|
* gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)Nikita Sobolev2022-12-23
|
* gh-78453: Move Unicode C API tests from test_unicode to ↵Serhiy Storchaka2022-11-14
| | | | test_capi.test_unicode (GH-99431)
* gh-99430: Remove duplicated tests for old-styled classes (#99432)Nikita Sobolev2022-11-13
| | | python 1 & 2 were a loong time ago.
* gh-94808: Improve coverage of `unicode_find` and `unicode_rfind` (#98648)Nikita Sobolev2022-10-25
|
* gh-94808: Cover `str.rsplit` for UCS1, UCS2 or UCS4 (#98228)Nikita Sobolev2022-10-15
|
* gh-97982: Factorize PyUnicode_Count() and unicode_count() code (#98025)Nikita Sobolev2022-10-12
| | | | Add unicode_count_impl() to factorize PyUnicode_Count() and unicode_count() code.
* gh-94808: Fix regex on exotic platforms (#98036)Jelle Zijlstra2022-10-07
| | | | | The test failed on a buildbot because the pointer was only 7 hex characters. To be safe, I bumped it down to 3: 4 in case we have 32-bit platforms, and 3 in case the pointer is very small.
* gh-94808: Cover `%p` in `PyUnicode_FromFormat` (#96677)Nikita Sobolev2022-10-07
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-94808: Cover `PyUnicode_Count` in CAPI (#96929)Nikita Sobolev2022-10-06
|
* gh-95781: More strict format string checking in PyUnicode_FromFormatV() ↵Serhiy Storchaka2022-08-08
| | | | | | | | | (GH-95784) An unrecognized format character in PyUnicode_FromFormat() and PyUnicode_FromFormatV() now sets a SystemError. In previous versions it caused all the rest of the format string to be copied as-is to the result string, and any extra arguments discarded.
* gh-93575: Use correct way to calculate PyUnicode struct sizes (GH-93602)Christian Heimes2022-06-08
| | | | | | | * gh-93575: Use correct way to calculate PyUnicode struct sizes * Add comment to keep test_sys and test_unicode in sync * Fix case code < 256
* gh-92536: Update unicode struct size to ensure MemoryError is raised (GH-92867)Dennis Sweeney2022-05-17
|
* gh-91576: Speed up iteration of strings (#91574)Kumar Aditya2022-04-18
|
* Use assertEqual, not assertEquals, in test_unicode (GH-31718)Dennis Sweeney2022-03-07
| | | Fixes a DeprecationWarning
* bpo-46903: Handle str-subclasses in virtual instance dictionaries. (GH-31658)Mark Shannon2022-03-04
|
* bpo-40066: [Enum] skip failing doc test (GH-30637)Kumar Aditya2022-01-17
|
* Revert "bpo-40066: [Enum] update str() and format() output (GH-30582)" ↵Victor Stinner2022-01-17
| | | | | (GH-30632) This reverts commit acf7403f9baea3ae1119fc6b4a3298522188bf96.
* bpo-40066: [Enum] update str() and format() output (GH-30582)Ethan Furman2022-01-15
| | | | | | | | | | | | | | | Undo rejected PEP-663 changes: - restore `repr()` to its 3.10 status - restore `str()` to its 3.10 status New changes: - `IntEnum` and `IntFlag` now leave `__str__` as the original `int.__str__` so that str() and format() return the same result - zero-valued flags without a name have a slightly changed repr(), e.g. `repr(Color(0)) == '<Color: 0>'` - update `dir()` for mixed-in types to return all the methods and attributes of the mixed-in type - added `_numeric_repr_` to `Flag` to control display of unnamed values - enums without doc strings have a more comprehensive doc string added - `ReprEnum` added -- inheriting from this makes it so only `__repr__` is replaced, not `__str__` nor `__format__`; `IntEnum`, `IntFlag`, and `StrEnum` all inherit from `ReprEnum`
* bpo-45668: Fix PGO tests without test extensions (GH-29315)Christian Heimes2021-11-01
|
* bpo-44891: Tests `id` preserving on `* 1` for `str` and `bytes` (GH-27745)Nikita Sobolev2021-08-13
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-28146: Fix a confusing error message in str.format() (GH-24213)Irit Katriel2021-05-13
| | | Automerge-Triggered-By: GH:pitrou
* bpo-44029: Remove Py_UNICODE APIs (GH-25881)Inada Naoki2021-05-07
| | | | | | | | | | | | Remove deprecated `Py_UNICODE` APIs: `PyUnicode_Encode`, `PyUnicode_EncodeUTF7`, `PyUnicode_EncodeUTF8`, `PyUnicode_EncodeUTF16`, `PyUnicode_EncodeUTF32`, `PyUnicode_EncodeLatin1`, `PyUnicode_EncodeMBCS`, `PyUnicode_EncodeDecimal`, `PyUnicode_EncodeRawUnicodeEscape`, `PyUnicode_EncodeCharmap`, `PyUnicode_EncodeUnicodeEscape`, `PyUnicode_TransformDecimalToASCII`, `PyUnicode_TranslateCharmap`, `PyUnicodeEncodeError_Create`, `PyUnicodeTranslateError_Create`. See :pep:`393` and :pep:`624` for reference.
* bpo-38659: [Enum] add _simple_enum decorator (GH-25497)Ethan Furman2021-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add: * `_simple_enum` decorator to transform a normal class into an enum * `_test_simple_enum` function to compare * `_old_convert_` to enable checking `_convert_` generated enums `_simple_enum` takes a normal class and converts it into an enum: @simple_enum(Enum) class Color: RED = 1 GREEN = 2 BLUE = 3 `_old_convert_` works much like` _convert_` does, using the original logic: # in a test file import socket, enum CheckedAddressFamily = enum._old_convert_( enum.IntEnum, 'AddressFamily', 'socket', lambda C: C.isupper() and C.startswith('AF_'), source=_socket, ) `_test_simple_enum` takes a traditional enum and a simple enum and compares the two: # in the REPL or the same module as Color class CheckedColor(Enum): RED = 1 GREEN = 2 BLUE = 3 _test_simple_enum(CheckedColor, Color) _test_simple_enum(CheckedAddressFamily, socket.AddressFamily) Any important differences will raise a TypeError
* Revert "bpo-38659: [Enum] add _simple_enum decorator (GH-25285)" (GH-25476)Ethan Furman2021-04-19
| | | This reverts commit dbac8f40e81eb0a29dc833e6409a1abf47467da6.
* bpo-38659: [Enum] add _simple_enum decorator (GH-25285)Ethan Furman2021-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add: _simple_enum decorator to transform a normal class into an enum _test_simple_enum function to compare _old_convert_ to enable checking _convert_ generated enums _simple_enum takes a normal class and converts it into an enum: @simple_enum(Enum) class Color: RED = 1 GREEN = 2 BLUE = 3 _old_convert_ works much like _convert_ does, using the original logic: # in a test file import socket, enum CheckedAddressFamily = enum._old_convert_( enum.IntEnum, 'AddressFamily', 'socket', lambda C: C.isupper() and C.startswith('AF_'), source=_socket, ) test_simple_enum takes a traditional enum and a simple enum and compares the two: # in the REPL or the same module as Color class CheckedColor(Enum): RED = 1 GREEN = 2 BLUE = 3 _test_simple_enum(CheckedColor, Color) _test_simple_enum(CheckedAddressFamily, socket.AddressFamily) Any important differences will raise a TypeError
* bpo-40066: Enum: modify `repr()` and `str()` (GH-22392)Ethan Furman2021-03-30
| | | | | | | | | * Enum: streamline repr() and str(); improve docs - repr() is now ``enum_class.member_name`` - stdlib global enums are ``module_name.member_name`` - str() is now ``member_name`` - add HOW-TO section for ``Enum`` - change main documentation to be an API reference
* bpo-43405: Fix DeprecationWarnings in test_unicode (GH-24754)Zackery Spytz2021-03-07
| | | | DeprecationWarnings were being raised in the test_encode_decimal() and test_transform_decimal() methods after 91a639a0949.
* bpo-36346: Emit DeprecationWarning for PyArg_Parse() with 'u' or 'Z'. (GH-20927)Inada Naoki2021-02-22
| | | | | Emit DeprecationWarning when PyArg_Parse*() is called with 'u', 'Z' format. See PEP 623.
* bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)Serhiy Storchaka2021-01-25
| | | | Previously it was an error with confusing error message.
* bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)Ronald Oussoren2020-11-08
| | | | | | | | | | | 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-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)Hai Shi2020-10-16
| | | | * Move the codecs' (un)register operation to testcases. * Remove _codecs._forget_codec() and _PyCodec_Forget()
* bpo-36346: Make using the legacy Unicode C API optional (GH-21437)Serhiy Storchaka2020-07-10
| | | | Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0 makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
* bpo-40275: Use new test.support helper submodules in tests (GH-21317)Hai Shi2020-07-06
|
* bpo-36346: Raise DeprecationWarning when creating legacy Unicode (GH-20933)Inada Naoki2020-06-30
|
* bpo-41055: Remove outdated tests for the tp_print slot. (GH-21006)Serhiy Storchaka2020-06-21
|
* bpo-40596: Fix str.isidentifier() for non-canonicalized strings containing ↵Serhiy Storchaka2020-05-12
| | | | non-BMP characters on Windows. (GH-20053)
* Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer()" (GH-18985)Inada Naoki2020-03-14
| | | | | | | * Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)" This reverts commit c7ad974d341d3edb6b9d2a2dcae4d3d4794ada6b. * Update unicodeobject.h
* bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)Inada Naoki2020-03-14
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* Update some www.unicode.org URLs to use HTTPS. (GH-18912)Benjamin Peterson2020-03-10
|
* bpo-15999: Clean up of handling boolean arguments. (GH-15610)Serhiy Storchaka2019-09-01
| | | | | | * Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
* bpo-36502: Correct documentation of str.isspace() (GH-15019)Greg Price2019-08-14
| | | | | | | | | | | | | | | | | | The documented definition was much broader than the real one: there are tons of characters with general category "Other", and we don't (and shouldn't) treat most of them as whitespace. Rewrite the definition to agree with the comment on _PyUnicode_IsWhitespace, and with the logic in makeunicodedata.py, which is what generates that function and so ultimately governs. Add suitable breadcrumbs so that a reader who wants to pin down exactly what this definition means (what's a "bidirectional class" of "B"?) can do so. The `unicodedata` module documentation is an appropriate central place for our references to Unicode's own copious documentation, so point there. Also add to the isspace() test a thorough check that the implementation agrees with the intended definition.
* bpo-37476: Adding tests for asutf8 and asutf8andsize (GH-14531)Hai Shi2019-07-20
|
* bpo-37388: Development mode check encoding and errors (GH-14341)Victor Stinner2019-06-26
| | | | | | | | | 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-36549: str.capitalize now titlecases the first character instead of ↵Kingsley M2019-04-12
| | | | uppercasing it (GH-12804)
* bpo-36297: remove "unicode_internal" codec (GH-12342)Inada Naoki2019-03-18
|
* bpo-33817: Fix _PyBytes_Resize() for empty bytes object. (GH-11516)Serhiy Storchaka2019-01-12
| | | | Add also tests for PyUnicode_FromFormat() and PyBytes_FromFormat() with empty result.
* Revert "bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)" (GH-9187)Victor Stinner2018-09-12
| | | This reverts commit 886483e2b9bbabf60ab769683269b873381dd5ee.
* bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)Victor Stinner2018-09-07
| | | | | | | | | * Add %T format to PyUnicode_FromFormatV(), and so to PyUnicode_FromFormat() and PyErr_Format(), to format an object type name: equivalent to "%s" with Py_TYPE(obj)->tp_name. * Replace Py_TYPE(obj)->tp_name with %T format in unicodeobject.c. * Add unit test on %T format. * Rename unicode_fromformat_write_cstr() to unicode_fromformat_write_utf8(), to make the intent more explicit.