From d39ddac48647ea6d35263e6bd4317aee4ce3c5de Mon Sep 17 00:00:00 2001 From: MegasKomnenos Date: Sun, 26 Mar 2023 10:54:35 +0900 Subject: [PATCH] Update bisect.py and test_bisect.py from CPython v3.11.2 --- Lib/bisect.py | 2 +- Lib/test/test_bisect.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/bisect.py b/Lib/bisect.py index d749af8e78d..d37da74f7b4 100644 --- a/Lib/bisect.py +++ b/Lib/bisect.py @@ -107,4 +107,4 @@ def bisect_left(a, x, lo=0, hi=None, *, key=None): # Create aliases bisect = bisect_right -insort = insort_right \ No newline at end of file +insort = insort_right diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py index 4ecde62a356..ba108221ebf 100644 --- a/Lib/test/test_bisect.py +++ b/Lib/test/test_bisect.py @@ -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.""" @@ -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