Skip to content

Commit 88a7559

Browse files
committed
Add test
1 parent b5c7a66 commit 88a7559

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_bisect.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ def test_negative_lo(self):
126126
self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3)
127127
self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3)
128128

129+
def test_negative_hi(self):
130+
# Issue 125889
131+
def assertNoRiases(f, *arg, **kwargs):
132+
try:
133+
f(*arg, **kwargs)
134+
except Exception:
135+
self.fail('Unable to work negative hi argument')
136+
mod = self.module
137+
# It can work negative values
138+
assertNoRiases(mod.bisect_left, [1, 2, 3], 5, 3, -2)
139+
assertNoRiases(mod.bisect_right, [1, 2, 3], 5, 3, -2)
140+
assertNoRiases(mod.insort_left, [1, 2, 3], 5, 3, -2)
141+
assertNoRiases(mod.insort_right, [1, 2, 3], 5, 3, -2)
142+
129143
def test_large_range(self):
130144
# Issue 13496
131145
mod = self.module

0 commit comments

Comments
 (0)