]> granicus.if.org Git - python/commitdiff
Idlelib.calltips: add test of starred first parameters. They should not be
authorTerry Jan Reedy <tjreedy@udel.edu>
Mon, 27 Jan 2014 02:34:33 +0000 (21:34 -0500)
committerTerry Jan Reedy <tjreedy@udel.edu>
Mon, 27 Jan 2014 02:34:33 +0000 (21:34 -0500)
removed even for bound methods. (Inspect.signature does, see 20401.)

Lib/idlelib/idle_test/test_calltips.py

index e71656b6aed773323a36ce3bc15e650a3c2ade4d..f3637646c47056193f7cc9b1c1fcee2d90b1f332 100644 (file)
@@ -122,6 +122,16 @@ bytes() -> empty bytes object''')
                             (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.