From: Yury Selivanov Date: Wed, 29 Jan 2014 16:54:12 +0000 (-0500) Subject: inspect.test.getfullargspec: Add a unittest to ensure correct annotations X-Git-Tag: v3.4.0rc1~193 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4cb939174c3fd45b5087ef5d2ca5c32a112b18d5;p=thirdparty%2FPython%2Fcpython.git inspect.test.getfullargspec: Add a unittest to ensure correct annotations handling #17481 --- diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 546fec5ff03e..19ccbcba65c6 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -586,6 +586,15 @@ class TestClassesAndFunctions(unittest.TestCase): self.assertFullArgSpecEquals(test, args_e=['spam'], formatted='(spam)') + def test_getfullargspec_signature_annos(self): + def test(a:'spam') -> 'ham': pass + spec = inspect.getfullargspec(test) + self.assertEqual(test.__annotations__, spec.annotations) + + def test(): pass + spec = inspect.getfullargspec(test) + self.assertEqual(test.__annotations__, spec.annotations) + @unittest.skipIf(MISSING_C_DOCSTRINGS, "Signature information for builtins requires docstrings") def test_getfullargspec_builtin_methods(self):