Replace deprecated inspect.getargspec

inspect.getargspec was deprecated since Python 3.0 and
inspect.getfullargspec is its replacement with correct handling of
function annotations and keyword-only parameters[1].

[1] https://docs.python.org/3/library/inspect.html#inspect.getargspec

Change-Id: Ifc98b578c4cb6f917e1fc62177fd09ff4d25b6d4
This commit is contained in:
Takashi Kajinami 2021-07-15 20:52:42 +09:00
parent 4c26e72d61
commit 0bf5bf5f2a
1 changed files with 10 additions and 10 deletions

View File

@ -357,8 +357,8 @@ class MovedMethodTest(test_base.TestCase):
self.assertEqual(0, len(capture))
def test_keeps_argspec(self):
self.assertEqual(inspect.getargspec(KittyKat.supermeow),
inspect.getargspec(KittyKat.meow))
self.assertEqual(inspect.getfullargspec(KittyKat.supermeow),
inspect.getfullargspec(KittyKat.meow))
class RenamedKwargTest(test_base.TestCase):
@ -416,8 +416,8 @@ class RenamedKwargTest(test_base.TestCase):
def test_argspec(self):
# The decorated function keeps its argspec.
self.assertEqual(inspect.getargspec(blip_blop_unwrapped),
inspect.getargspec(blip_blop))
self.assertEqual(inspect.getfullargspec(blip_blop_unwrapped),
inspect.getfullargspec(blip_blop))
class UpdatedArgsTest(test_base.TestCase):
@ -438,8 +438,8 @@ class UpdatedArgsTest(test_base.TestCase):
self.assertEqual(0, len(capture))
def test_argspec_preserved(self):
self.assertEqual(inspect.getargspec(blip_blop_blip_unwrapped),
inspect.getargspec(blip_blop_blip))
self.assertEqual(inspect.getfullargspec(blip_blop_blip_unwrapped),
inspect.getfullargspec(blip_blop_blip))
class RemovalTests(test_base.TestCase):
@ -452,8 +452,8 @@ class RemovalTests(test_base.TestCase):
def test_function_keeps_argspec(self):
# The decorated function keeps its argspec.
self.assertEqual(
inspect.getargspec(crimson_lightning_unwrapped),
inspect.getargspec(crimson_lightning))
inspect.getfullargspec(crimson_lightning_unwrapped),
inspect.getfullargspec(crimson_lightning))
def test_deprecated_kwarg(self):
@ -481,8 +481,8 @@ class RemovalTests(test_base.TestCase):
def f_unwrapped(b=2):
return b
self.assertEqual(inspect.getargspec(f_unwrapped),
inspect.getargspec(f))
self.assertEqual(inspect.getfullargspec(f_unwrapped),
inspect.getfullargspec(f))
def test_pending_deprecated_kwarg(self):