diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-02 21:47:10 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-02 21:47:10 +0000 |
commit | 83f86e8e98ff789f1c2832860ff78a59562db37d (patch) | |
tree | 2fc09e6d45123725835daf2e433d2f3db567c6c2 /Lib/test/string_tests.py | |
parent | b56fb12b74b5e4123061b0e9a09043479614ab9f (diff) | |
download | cpython-git-83f86e8e98ff789f1c2832860ff78a59562db37d.tar.gz |
Add tests for issue #7458: str.rfind() would crash when called with an invalid
start value. The offending code itself was removed as part of #7462.
This patch by Victor Stinner.
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r-- | Lib/test/string_tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 988372dd71..5d4f9eb6aa 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -185,6 +185,9 @@ class CommonTest(unittest.TestCase): self.checkequal(-1, '', 'find', 'xx', 1, 1) self.checkequal(-1, '', 'find', 'xx', sys.maxint, 0) + # issue 7458 + self.checkequal(-1, 'ab', 'find', 'xxx', sys.maxsize + 1, 0) + # For a variety of combinations, # verify that str.find() matches __contains__ # and that the found substring is really at that location @@ -255,6 +258,9 @@ class CommonTest(unittest.TestCase): if loc != -1: self.assertEqual(i[loc:loc+len(j)], j) + # issue 7458 + self.checkequal(-1, 'ab', 'rfind', 'xxx', sys.maxsize + 1, 0) + def test_index(self): self.checkequal(0, 'abcdefghiabc', 'index', '') self.checkequal(3, 'abcdefghiabc', 'index', 'def') |