Benjamin Peterson
bb904e063d
closes gh-124016: update Unicode to 16.0.0 ( #124017 )
2024-09-13 07:47:04 -07:00
Erlend E. Aasland
7ecd55d604
gh-117431: Adapt str.find and friends to Argument Clinic ( #117468 )
...
This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used. The following methods are adapted:
- str.count
- str.find
- str.index
- str.rfind
- str.rindex
2024-04-03 17:59:18 +02:00
Erlend E. Aasland
444156ede4
gh-117431: Adapt str.startswith and str.endswith to Argument Clinic ( #117466 )
...
This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used.
2024-04-03 09:11:39 +02:00
Nikita Sobolev
06faa9a39b
gh-110160: Fix flaky `test_find_periodic_pattern` in `string_tests` ( #110170 )
2023-10-01 16:20:01 +02:00
Hugo van Kemenade
34c14147a2
gh-106487: Allow the 'count' argument of `str.replace` to be a keyword ( #106488 )
2023-07-10 12:52:36 +03:00
Daniel Fortunov
ddb1485953
gh-81005: Refactor str tests to reflect that str and unicode are merged in Python 3 ( #13172 )
...
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-05-23 17:11:29 +03:00
Nikita Sobolev
b7dd2cad18
gh-94808: Cover `str.rsplit` for UCS1, UCS2 or UCS4 ( #98228 )
2022-10-15 11:40:22 -07:00
Dennis Sweeney
69d9a08099
gh-94808: improve comments and coverage of fastsearch.h (GH-96760)
2022-09-13 14:25:10 -04:00
Christian Heimes
e73283a20f
bpo-45668: Fix PGO tests without test extensions (GH-29315)
2021-11-01 11:14:53 +01:00
Miguel Brito
ed1076428c
bpo-44110: Improve string's __getitem__ error message (GH-26042)
2021-06-27 15:04:57 +03:00
Dennis Sweeney
73a85c4e1d
bpo-41972: Use the two-way algorithm for string searching (GH-22904)
...
Implement an enhanced variant of Crochemore and Perrin's Two-Way string searching algorithm, which reduces worst-case time from quadratic (the product of the string and pattern lengths) to linear. This applies to forward searches (like``find``, ``index``, ``replace``); the algorithm for reverse searches (like ``rfind``) is not changed.
Co-authored-by: Tim Peters <tim.peters@gmail.com>
2021-02-28 12:20:50 -06:00
sweeneyde
a81849b031
bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939)
...
Added str.removeprefix and str.removesuffix methods and corresponding
bytes, bytearray, and collections.UserString methods to remove affixes
from a string if present. See PEP 616 for a full description.
2020-04-22 23:05:48 +02:00
Serhiy Storchaka
865c3b257f
bpo-28029: Make "".replace("", s, n) returning s for any n != 0. (GH-16981)
2019-10-30 12:03:53 +02:00
Zackery Spytz
14514d9084
bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)
...
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>
2019-05-17 10:13:03 +03:00
Kingsley M
b015fc86f7
bpo-36549: str.capitalize now titlecases the first character instead of uppercasing it (GH-12804)
2019-04-12 08:35:39 -07:00
INADA Naoki
bea57060c8
bpo-32677: Optimize str.isascii() (GH-5356)
2018-01-28 09:59:12 +09:00
INADA Naoki
a49ac99029
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)
2018-01-27 14:06:21 +09:00
Martin Panter
731b1b12b8
Remove relics of str8 (became bytes) and buffer (bytearray) type tests
...
Remove redundant tests now that str is unicode.
2016-04-10 08:48:51 +00:00
Martin Panter
0d0db6cc1e
Issue #26712 : Unify (r)split, (l/r)strip tests into string_tests
...
This eliminates a few redundant test cases.
2016-04-10 08:45:26 +00:00
Martin Panter
152a19c6bd
Issue #26257 : Eliminate buffer_tests.py and fix ByteArrayAsStringTest
...
ByteArrayAsStringTest.fixtype() was converting test data to bytes, not byte-
array, therefore many of the test cases inherited in this class were not
actually being run on the bytearray type.
The tests in buffer_tests.py were redundant with methods in string_tests
.MixinStrUnicodeUserStringTest and string_tests.CommonTest. These methods are
now moved into string_tests.BaseTest, where they will also get run for bytes
and bytearray.
This change also moves test_additional_split(), test_additional_rsplit(), and
test_strip() from CommonTest to BaseTest, meaning these tests are now run for
bytes and bytearray. I plan to eliminate redundancies with existing tests in
test_bytes.py soon.
2016-04-06 06:37:17 +00:00
Martin Panter
275bd96aa6
Issue #19587 : Remove masked and redundant tests in test_bytes
...
* test_contains() did not override anything
* test_expandtabs/upper/lower() in FixedStringTest were masking usable tests
in string_tests. These tests now get run for bytearray() and bytes().
* test_expandtabs/upper/lower() in buffer_tests were only run on bytearray()
and are redundant with string_tests
2016-02-02 10:37:15 +00:00
Martin Panter
6f9b010242
Fix a couple of typos in code comments
2015-12-17 10:18:28 +00:00
Serhiy Storchaka
d4ea03c785
Issue #24284 : The startswith and endswith methods of the str class no longer
...
return True when finding the empty string and the indexes are completely out
of range.
2015-05-31 09:15:51 +03:00
Benjamin Peterson
a2f93885b0
merge 3.4 ( #22379 )
2014-09-28 12:57:22 -04:00
Benjamin Peterson
c31f12d196
check that exception messages are not empty ( #22379 )
...
Patch by Yongzhi Pan.
2014-09-28 12:56:42 -04:00
Ethan Furman
38d872ee5d
Issue19995: passing a non-int to %o, %c, %x, or %X now raises an exception
2014-03-19 08:38:52 -07:00
Serhiy Storchaka
f28ba369dd
Issue #20532 : Tests which use _testcapi now are marked as CPython only.
2014-02-07 10:10:55 +02:00
Serhiy Storchaka
5cfc79deae
Issue #20532 : Tests which use _testcapi now are marked as CPython only.
2014-02-07 10:06:39 +02:00
Serhiy Storchaka
a146bef02b
Catch deprecation warnings emitted when non-integers are formatted with %c, %o
...
and %x (introduced in issue #19995 ).
2014-02-06 22:44:27 +02:00
Zachary Ware
101d9e7250
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:44:27 -06:00
Zachary Ware
9fe6d86709
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:20:35 -06:00
Ezio Melotti
745d54d2fa
#17806 : Added keyword-argument support for "tabsize" to str/bytes.expandtabs().
2013-11-16 19:10:57 +02:00
Ezio Melotti
65f7a9e3c0
Remove duplicated tests.
2013-04-21 03:55:17 +03:00
Serhiy Storchaka
9101e23ff6
Issue #15989 : Fix several occurrences of integer overflow
...
when result of PyLong_AsLong() narrowed to int without checks.
This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:41:45 +02:00
Serhiy Storchaka
441d30fac7
Issue #15989 : Fix several occurrences of integer overflow
...
when result of PyLong_AsLong() narrowed to int without checks.
This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:26:26 +02:00
Ezio Melotti
0dceb560b6
#16910 : test_bytes, test_unicode, and test_userstring now work with unittest test discovery. Patch by Zachary Ware.
2013-01-10 07:43:26 +02:00
Benjamin Peterson
59043f96ea
merge 3.2 ( #15801 )
2012-08-28 18:01:45 -04:00
Benjamin Peterson
28a6cfaefc
use the stricter PyMapping_Check ( closes #15801 )
2012-08-28 17:55:35 -04:00
Victor Stinner
b3f5501250
Close #15534 : Fix a typo in the fast search function of the string library (_s => s)
...
Replace _s with ptr to avoid future confusion. Add also non regression tests.
2012-08-02 23:05:01 +02:00
Mark Dickinson
99e2e5552a
Issue #14700 : Fix two broken and undefined-behaviour-inducing overflow checks in old-style string formatting. Thanks Serhiy Storchaka for report and original patch.
2012-05-07 11:20:50 +01:00
Ezio Melotti
cda6b6d60d
#14081 : The sep and maxsplit parameter to str.split, bytes.split, and bytearray.split may now be passed as keyword arguments.
2012-02-26 09:39:55 +02:00
Benjamin Peterson
b2bf01d824
use full unicode mappings for upper/lower/title case ( #12736 )
...
Also broaden the category of characters that count as lowercase/uppercase.
2012-01-11 18:17:06 -05:00
Antoine Pitrou
ac65d96777
Issue #12170 : The count(), find(), rfind(), index() and rindex() methods
...
of bytes and bytearray objects now accept an integer between 0 and 255
as their first argument. Patch by Petri Lehtinen.
2011-10-20 23:54:17 +02:00
Mark Dickinson
0d5f6adbb3
Issue #13012 : Allow 'keepends' to be passed as a keyword argument in str.splitlines, bytes.splitlines and bytearray.splitlines.
2011-09-24 09:14:39 +01:00
Ezio Melotti
ee8d998ecf
#12266 : Fix str.capitalize() to correctly uppercase/lowercase titlecased and cased non-letter characters.
2011-08-15 09:09:57 +03:00
Ezio Melotti
af92842bf9
Use non-deprecated method name.
2011-04-20 21:56:21 +03:00
Jesus Cea
6159ee3cf5
MERGE: startswith and endswith don't accept None as slice index. Patch by Torsten Becker. ( closes #11828 )
2011-04-20 17:42:50 +02:00
Jesus Cea
ac4515063c
startswith and endswith don't accept None as slice index. Patch by Torsten Becker. ( closes #11828 )
2011-04-20 17:09:23 +02:00
Ezio Melotti
19f2aeba67
Merged revisions 86596 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line
#9424 : Replace deprecated assert* methods in the Python test suite.
........
2010-11-21 01:30:29 +00:00
Ezio Melotti
b3aedd4862
#9424 : Replace deprecated assert* methods in the Python test suite.
2010-11-20 19:04:17 +00:00