summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 00:17:41 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 00:17:41 (GMT)
commitf8eac00779c4a3c66a85a3737f0977bb54305e05 (patch)
tree1b49c9167cf5f26ebd5b1208b1b342329f845069 /Lib/test/test_bytes.py
parente010fc029daa0a445c9d7ab78d4cd4f12b42a991 (diff)
downloadcpython-f8eac00779c4a3c66a85a3737f0977bb54305e05.zip
cpython-f8eac00779c4a3c66a85a3737f0977bb54305e05.tar.gz
cpython-f8eac00779c4a3c66a85a3737f0977bb54305e05.tar.bz2
Issue #13623: Fix a performance regression introduced by issue #12170 in
bytes.find() and handle correctly OverflowError (raise the same ValueError than the error for -1).
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r--Lib/test/test_bytes.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 7acfde5..bfb88de 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -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