From 11ac5b6f468dbb1be98d9d071a80dadabe060710 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Thu, 6 Dec 2018 21:05:46 +0100 Subject: [PATCH 1/3] bpo-35429: Use raise NotImplementedError instead of NotImplemented --- Lib/idlelib/debugger_r.py | 2 +- Lib/ssl.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/debugger_r.py b/Lib/idlelib/debugger_r.py index 01a3bd25998fc04..0e6dcfbd12c2ab7 100644 --- a/Lib/idlelib/debugger_r.py +++ b/Lib/idlelib/debugger_r.py @@ -157,7 +157,7 @@ def code_filename(self, cid): #----------called by a DictProxy---------- def dict_keys(self, did): - raise NotImplemented("dict_keys not public or pickleable") + raise NotImplementedError("dict_keys not public or pickleable") ## dict = dicttable[did] ## return dict.keys() diff --git a/Lib/ssl.py b/Lib/ssl.py index 8f6d402209b15f2..e6e3a6d0fa8d186 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -884,8 +884,8 @@ def session_reused(self): return self._sslobj.session_reused def dup(self): - raise NotImplemented("Can't dup() %s instances" % - self.__class__.__name__) + raise NotImplementedError("Can't dup() %s instances" % + self.__class__.__name__) def _checkClosed(self, msg=None): # raise an exception here if you wish to check for spurious closes From d96bf897bd8f844c8f49d480094f3244a3a42aeb Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Thu, 6 Dec 2018 22:02:38 +0100 Subject: [PATCH 2/3] Add regression tests --- Lib/idlelib/idle_test/test_debugger_r.py | 6 ++++++ Lib/test/test_ssl.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/Lib/idlelib/idle_test/test_debugger_r.py b/Lib/idlelib/idle_test/test_debugger_r.py index 199f63447ce6cac..99d8cfc3f88015a 100644 --- a/Lib/idlelib/idle_test/test_debugger_r.py +++ b/Lib/idlelib/idle_test/test_debugger_r.py @@ -21,6 +21,12 @@ class Test(unittest.TestCase): def test_init(self): self.assertTrue(True) # Get coverage of import + def test_idbadapter_dict_keys(self): + adapter = debugger_r.IdbAdapter(None) + + with self.assertRaises(NotImplementedError): + adapter.dict_keys() + # Classes GUIProxy, IdbAdapter, FrameProxy, CodeProxy, DictProxy, # GUIAdapter, IdbProxy plus 7 module functions. diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 74a91f6c23961e2..c9bd43a81614276 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -3531,6 +3531,10 @@ def serve(): server.close() # Sanity checks. self.assertIsInstance(remote, ssl.SSLSocket) + + with self.assertRaises(NotImplementedError): + remote.dup() + self.assertEqual(peer, client_addr) def test_getpeercert_enotconn(self): From 88aab8745b238acc990e66e6e8c4dcb449b73e9a Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Thu, 6 Dec 2018 22:39:12 +0100 Subject: [PATCH 3/3] Fix CI --- Lib/idlelib/idle_test/test_debugger_r.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/idlelib/idle_test/test_debugger_r.py b/Lib/idlelib/idle_test/test_debugger_r.py index 99d8cfc3f88015a..c23bbe422ea3eb2 100644 --- a/Lib/idlelib/idle_test/test_debugger_r.py +++ b/Lib/idlelib/idle_test/test_debugger_r.py @@ -25,7 +25,7 @@ def test_idbadapter_dict_keys(self): adapter = debugger_r.IdbAdapter(None) with self.assertRaises(NotImplementedError): - adapter.dict_keys() + adapter.dict_keys(None) # Classes GUIProxy, IdbAdapter, FrameProxy, CodeProxy, DictProxy,