summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-08-02 21:05:01 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-08-02 21:05:01 (GMT)
commitb3f5501250b54de24846480658ca473a5393db49 (patch)
tree599b03a679fcb27457d67940279487ed20518c8b /Lib
parent77821b68a7f23318374087e9c6710ef66312f78d (diff)
downloadcpython-b3f5501250b54de24846480658ca473a5393db49.zip
cpython-b3f5501250b54de24846480658ca473a5393db49.tar.gz
cpython-b3f5501250b54de24846480658ca473a5393db49.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/string_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index eeeb457..8da3e77 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -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......&lt;', '...\u043c......<', "replace", "<", "&lt;")
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.