mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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.
This commit is contained in:
parent
77821b68a7
commit
b3f5501250
3 changed files with 16 additions and 6 deletions
|
@ -262,6 +262,9 @@ class BaseTest(unittest.TestCase):
|
|||
# issue 7458
|
||||
self.checkequal(-1, 'ab', 'rfind', 'xxx', sys.maxsize + 1, 0)
|
||||
|
||||
# issue #15534
|
||||
self.checkequal(0, '<......\u043c...', "rfind", "<")
|
||||
|
||||
def test_index(self):
|
||||
self.checkequal(0, 'abcdefghiabc', 'index', '')
|
||||
self.checkequal(3, 'abcdefghiabc', 'index', 'def')
|
||||
|
@ -597,6 +600,8 @@ class BaseTest(unittest.TestCase):
|
|||
EQ("ReyKKjavik", "Reykjavik", "replace", "k", "KK", 1)
|
||||
EQ("Reykjavik", "Reykjavik", "replace", "k", "KK", 0)
|
||||
EQ("A----B----C----", "A.B.C.", "replace", ".", "----")
|
||||
# issue #15534
|
||||
EQ('...\u043c......<', '...\u043c......<', "replace", "<", "<")
|
||||
|
||||
EQ("Reykjavik", "Reykjavik", "replace", "q", "KK")
|
||||
|
||||
|
@ -1316,6 +1321,9 @@ class MixinStrUnicodeUserStringTest:
|
|||
self.assertRaisesRegex(TypeError, r'^endswith\(', s.endswith,
|
||||
x, None, None, None)
|
||||
|
||||
# issue #15534
|
||||
self.checkequal(10, "...\u043c......<", "find", "<")
|
||||
|
||||
|
||||
class MixinStrUnicodeTest:
|
||||
# Additional tests that only work with str and unicode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue