[Python-checkins] cpython (3.3): Idlelib.calltips: add test of starred first parameters. They should not be

terry.reedy python-checkins at python.org
Mon Jan 27 03:35:43 CET 2014


http://hg.python.org/cpython/rev/9ac2016815c9
changeset:   88751:9ac2016815c9
branch:      3.3
parent:      88746:bebc8fd20e97
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Sun Jan 26 21:34:33 2014 -0500
summary:
  Idlelib.calltips: add test of starred first parameters. They should not be
removed even for bound methods. (Inspect.signature does, see 20401.)

files:
  Lib/idlelib/idle_test/test_calltips.py |  10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/Lib/idlelib/idle_test/test_calltips.py b/Lib/idlelib/idle_test/test_calltips.py
--- a/Lib/idlelib/idle_test/test_calltips.py
+++ b/Lib/idlelib/idle_test/test_calltips.py
@@ -122,6 +122,16 @@
                             (tc.__call__, '(ci)'), (tc, '(ci)'), (TC.cm, "(a)"),):
             self.assertEqual(signature(meth), mtip + "\ndoc")
 
+    def test_starred_parameter(self):
+        # test that starred first parameter is *not* removed from argspec
+        class C:
+            def m1(*args): pass
+            def m2(**kwds): pass
+        c = C()
+        for meth, mtip  in ((C.m1, '(*args)'), (c.m1, "(*args)"),
+                                      (C.m2, "(**kwds)"), (c.m2, "(**kwds)"),):
+            self.assertEqual(signature(meth), mtip)
+
     def test_non_ascii_name(self):
         # test that re works to delete a first parameter name that
         # includes non-ascii chars, such as various forms of A.

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


More information about the Python-checkins mailing list