]> granicus.if.org Git - python/commitdiff
inspect.test.getfullargspec: Add a unittest to ensure correct annotations
authorYury Selivanov <yselivanov@sprymix.com>
Wed, 29 Jan 2014 16:54:12 +0000 (11:54 -0500)
committerYury Selivanov <yselivanov@sprymix.com>
Wed, 29 Jan 2014 16:54:12 +0000 (11:54 -0500)
handling #17481

Lib/test/test_inspect.py

index 546fec5ff03e8d7b0998f91b367df6f3896578a0..19ccbcba65c6454e2a6112e6a84c15d99a7f3fed 100644 (file)
@@ -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):