summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bisect.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-04-15 15:30:35 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-04-15 15:30:35 (GMT)
commita13b109bc00487182b13c1d02c03e8910dfb9234 (patch)
tree4043e61e11e85fc06117149f879283e09ab99e28 /Lib/test/test_bisect.py
parent18e3d81f96a592a0307fa41645017483eabcfc51 (diff)
downloadcpython-a13b109bc00487182b13c1d02c03e8910dfb9234.zip
cpython-a13b109bc00487182b13c1d02c03e8910dfb9234.tar.gz
cpython-a13b109bc00487182b13c1d02c03e8910dfb9234.tar.bz2
Issue 13496: Fix bisect.bisect overflow bug for large collections.
Diffstat (limited to 'Lib/test/test_bisect.py')
-rw-r--r--Lib/test/test_bisect.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py
index 93b8613..c24a1a2 100644
--- a/Lib/test/test_bisect.py
+++ b/Lib/test/test_bisect.py
@@ -122,6 +122,13 @@ class TestBisect(unittest.TestCase):
self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3),
self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3),
+ def test_large_range(self):
+ # Issue 13496
+ mod = self.module
+ data = range(sys.maxsize-1)
+ self.assertEqual(mod.bisect_left(data, sys.maxsize-3), sys.maxsize-3)
+ self.assertEqual(mod.bisect_right(data, sys.maxsize-3), sys.maxsize-2)
+
def test_random(self, n=25):
from random import randrange
for i in range(n):