[Python-checkins] cpython: inspect.test.getfullargspec: Add a unittest to ensure correct annotations

yury.selivanov python-checkins at python.org
Wed Jan 29 17:54:27 CET 2014


http://hg.python.org/cpython/rev/0fa2750c7241
changeset:   88813:0fa2750c7241
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Wed Jan 29 11:54:12 2014 -0500
summary:
  inspect.test.getfullargspec: Add a unittest to ensure correct annotations
handling #17481

files:
  Lib/test/test_inspect.py |  9 +++++++++
  1 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -586,6 +586,15 @@
 
         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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list