mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue 3301: Bisect functions behaved badly when lo was negative.
This commit is contained in:
parent
d2cd86ddd5
commit
3cd1e42dca
4 changed files with 27 additions and 0 deletions
|
@ -114,6 +114,14 @@ class TestBisect(unittest.TestCase):
|
|||
self.assertEqual(func(data, elem), expected)
|
||||
self.assertEqual(func(UserList(data), elem), expected)
|
||||
|
||||
def test_negative_lo(self):
|
||||
# Issue 3301
|
||||
mod = self.module
|
||||
self.assertRaises(ValueError, mod.bisect_left, [1, 2, 3], 5, -1, 3),
|
||||
self.assertRaises(ValueError, mod.bisect_right, [1, 2, 3], 5, -1, 3),
|
||||
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_random(self, n=25):
|
||||
from random import randrange
|
||||
for i in xrange(n):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue