Commit 6d0b7470 authored by Xtreak's avatar Xtreak Committed by Miss Islington (bot)

bpo-37099: Silence DeprecationWarning in test_inspect (GH-13679)



Fix DeprecationWarning introduced in aee19f54


https://bugs.python.org/issue37099
parent 249b7d59
...@@ -750,14 +750,16 @@ class TestClassesAndFunctions(unittest.TestCase): ...@@ -750,14 +750,16 @@ class TestClassesAndFunctions(unittest.TestCase):
def assertArgSpecEquals(self, routine, args_e, varargs_e=None, def assertArgSpecEquals(self, routine, args_e, varargs_e=None,
varkw_e=None, defaults_e=None, formatted=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(args, args_e)
self.assertEqual(varargs, varargs_e) self.assertEqual(varargs, varargs_e)
self.assertEqual(varkw, varkw_e) self.assertEqual(varkw, varkw_e)
self.assertEqual(defaults, defaults_e) self.assertEqual(defaults, defaults_e)
if formatted is not None: if formatted is not None:
self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults), with self.assertWarns(DeprecationWarning):
formatted) self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults),
formatted)
def assertFullArgSpecEquals(self, routine, args_e, varargs_e=None, def assertFullArgSpecEquals(self, routine, args_e, varargs_e=None,
varkw_e=None, defaults_e=None, varkw_e=None, defaults_e=None,
...@@ -774,9 +776,10 @@ class TestClassesAndFunctions(unittest.TestCase): ...@@ -774,9 +776,10 @@ class TestClassesAndFunctions(unittest.TestCase):
self.assertEqual(kwonlydefaults, kwonlydefaults_e) self.assertEqual(kwonlydefaults, kwonlydefaults_e)
self.assertEqual(ann, ann_e) self.assertEqual(ann, ann_e)
if formatted is not None: if formatted is not None:
self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults, with self.assertWarns(DeprecationWarning):
kwonlyargs, kwonlydefaults, ann), self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults,
formatted) kwonlyargs, kwonlydefaults, ann),
formatted)
def test_getargspec(self): def test_getargspec(self):
self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted='(x, y)') self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted='(x, y)')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment