Skip to content

Commit afe5e96

Browse files
authored
Merge pull request #4774 from MegasKomnenos/bisect
Update bisect.py and test_bisect.py from CPython v3.11.2
2 parents 6f8a652 + d39ddac commit afe5e96

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Lib/bisect.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ def bisect_left(a, x, lo=0, hi=None, *, key=None):
107107

108108
# Create aliases
109109
bisect = bisect_right
110-
insort = insort_right
110+
insort = insort_right

Lib/test/test_bisect.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
py_bisect = import_helper.import_fresh_module('bisect', blocked=['_bisect'])
8-
c_bisect = import_helper.import_fresh_module('bisect', fresh=['bisect'])
8+
c_bisect = import_helper.import_fresh_module('bisect', fresh=['_bisect'])
99

1010
class Range(object):
1111
"""A trivial range()-like object that has an insert() method."""
@@ -257,6 +257,12 @@ def test_insort(self):
257257
target
258258
)
259259

260+
def test_insort_keynotNone(self):
261+
x = []
262+
y = {"a": 2, "b": 1}
263+
for f in (self.module.insort_left, self.module.insort_right):
264+
self.assertRaises(TypeError, f, x, y, key = "b")
265+
260266
class TestBisectPython(TestBisect, unittest.TestCase):
261267
module = py_bisect
262268

0 commit comments

Comments
 (0)