Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/bisect.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ def bisect_left(a, x, lo=0, hi=None, *, key=None):

# Create aliases
bisect = bisect_right
insort = insort_right
insort = insort_right
8 changes: 7 additions & 1 deletion Lib/test/test_bisect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


py_bisect = import_helper.import_fresh_module('bisect', blocked=['_bisect'])
c_bisect = import_helper.import_fresh_module('bisect', fresh=['bisect'])
c_bisect = import_helper.import_fresh_module('bisect', fresh=['_bisect'])

class Range(object):
"""A trivial range()-like object that has an insert() method."""
Expand Down Expand Up @@ -257,6 +257,12 @@ def test_insort(self):
target
)

def test_insort_keynotNone(self):
x = []
y = {"a": 2, "b": 1}
for f in (self.module.insort_left, self.module.insort_right):
self.assertRaises(TypeError, f, x, y, key = "b")

class TestBisectPython(TestBisect, unittest.TestCase):
module = py_bisect

Expand Down