diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2013-07-26 22:21:32 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2013-07-26 22:21:32 (GMT) |
commit | 349065500a0b21c0c296b4fb4b0484f5ac7d35cc (patch) | |
tree | 20564590d78be6717e29870fedd8c5568a617f30 /Lib/idlelib | |
parent | d5648ac382e3374d71545be6a04880c1f2c6ffb8 (diff) | |
download | cpython-349065500a0b21c0c296b4fb4b0484f5ac7d35cc.zip cpython-349065500a0b21c0c296b4fb4b0484f5ac7d35cc.tar.gz cpython-349065500a0b21c0c296b4fb4b0484f5ac7d35cc.tar.bz2 |
Issue #18539: Calltips now work for float default arguments.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/CallTips.py | 2 | ||||
-rw-r--r-- | Lib/idlelib/idle_test/test_calltips.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py index 0fdef11..c29f89b 100644 --- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -163,7 +163,7 @@ def get_arg_text(ob): if fob.func_code.co_flags & 0x8: items.append("***") arg_text = ", ".join(items) - arg_text = "(%s)" % re.sub("\.\d+", "<tuple>", arg_text) + arg_text = "(%s)" % re.sub("(?<!\d)\.\d+", "<tuple>", arg_text) # See if we can use the docstring doc = getattr(ob, "__doc__", "") if doc: diff --git a/Lib/idlelib/idle_test/test_calltips.py b/Lib/idlelib/idle_test/test_calltips.py index 1733d39..e0f1665 100644 --- a/Lib/idlelib/idle_test/test_calltips.py +++ b/Lib/idlelib/idle_test/test_calltips.py @@ -10,5 +10,11 @@ class Test_get_entity(unittest.TestCase): def test_good_entity(self): self.assertIs(CTi.get_entity('int'), int) +class Py2Test(unittest.TestCase): + def test_paramtuple_float(self): + # 18539: (a,b) becomes '.0' in code object; change that but not float + def f((a,b), c=0.0): pass + self.assertEqual(ct.get_arg_text(f), '(<tuple>, c=0.0)') + if __name__ == '__main__': unittest.main(verbosity=2, exit=False) |