summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXtreak <tir.karthi@gmail.com>2019-05-30 12:01:39 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-30 12:01:39 (GMT)
commit6d0b7470a4738a403ef48cfd50d9447e0f32f00c (patch)
treefd12d2faa33e9f2c7a608fef6bb2ba9a881e0a36
parent249b7d59d8038f9017fc95dc28a3ce3494aaf832 (diff)
downloadcpython-6d0b7470a4738a403ef48cfd50d9447e0f32f00c.zip
cpython-6d0b7470a4738a403ef48cfd50d9447e0f32f00c.tar.gz
cpython-6d0b7470a4738a403ef48cfd50d9447e0f32f00c.tar.bz2
bpo-37099: Silence DeprecationWarning in test_inspect (GH-13679)
Fix DeprecationWarning introduced in aee19f54f6fe45f6b3c906987941e5a8af4468e9 https://bugs.python.org/issue37099
-rw-r--r--Lib/test/test_inspect.py15
1 files 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)')