From 6d0b7470a4738a403ef48cfd50d9447e0f32f00c Mon Sep 17 00:00:00 2001 From: Xtreak Date: Thu, 30 May 2019 17:31:39 +0530 Subject: bpo-37099: Silence DeprecationWarning in test_inspect (GH-13679) Fix DeprecationWarning introduced in aee19f54f6fe45f6b3c906987941e5a8af4468e9 https://bugs.python.org/issue37099 --- Lib/test/test_inspect.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index b3aae3a..83a5f7e 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -750,14 +750,16 @@ class TestClassesAndFunctions(unittest.TestCase): def assertArgSpecEquals(self, routine, args_e, varargs_e=None, varkw_e=None, defaults_e=None, formatted=None): - args, varargs, varkw, defaults = inspect.getargspec(routine) + with self.assertWarns(DeprecationWarning): + args, varargs, varkw, defaults = inspect.getargspec(routine) self.assertEqual(args, args_e) self.assertEqual(varargs, varargs_e) self.assertEqual(varkw, varkw_e) self.assertEqual(defaults, defaults_e) if formatted is not None: - self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults), - formatted) + with self.assertWarns(DeprecationWarning): + self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults), + formatted) def assertFullArgSpecEquals(self, routine, args_e, varargs_e=None, varkw_e=None, defaults_e=None, @@ -774,9 +776,10 @@ class TestClassesAndFunctions(unittest.TestCase): self.assertEqual(kwonlydefaults, kwonlydefaults_e) self.assertEqual(ann, ann_e) if formatted is not None: - self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults, - kwonlyargs, kwonlydefaults, ann), - formatted) + with self.assertWarns(DeprecationWarning): + self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults, + kwonlyargs, kwonlydefaults, ann), + formatted) def test_getargspec(self): self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted='(x, y)') -- cgit v0.12