mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bytes.find() and handle correctly OverflowError (raise the same ValueError than the error for -1).
This commit is contained in:
parent
e010fc029d
commit
f8eac00779
2 changed files with 23 additions and 11 deletions
|
@ -362,6 +362,11 @@ class BaseBytesTest(unittest.TestCase):
|
|||
self.assertEqual(b.find(i, 1, 3), 1)
|
||||
self.assertEqual(b.find(w, 1, 3), -1)
|
||||
|
||||
for index in (-1, 256, sys.maxsize + 1):
|
||||
self.assertRaisesRegex(
|
||||
ValueError, r'byte must be in range\(0, 256\)',
|
||||
b.find, index)
|
||||
|
||||
def test_rfind(self):
|
||||
b = self.type2test(b'mississippi')
|
||||
i = 105
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue