summaryrefslogtreecommitdiff
path: root/Lib/idlelib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/calltip.py2
-rw-r--r--Lib/idlelib/idle_test/test_calltip.py29
2 files changed, 30 insertions, 1 deletions
diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py
index 758569a45f..2a9a131ed9 100644
--- a/Lib/idlelib/calltip.py
+++ b/Lib/idlelib/calltip.py
@@ -167,7 +167,7 @@ def get_argspec(ob):
if len(line) > _MAX_COLS:
line = line[: _MAX_COLS - 3] + '...'
lines.append(line)
- argspec = '\n'.join(lines)
+ argspec = '\n'.join(lines)
if not argspec:
argspec = _default_callable_argspec
return argspec
diff --git a/Lib/idlelib/idle_test/test_calltip.py b/Lib/idlelib/idle_test/test_calltip.py
index 0698d4f8b9..833351bd79 100644
--- a/Lib/idlelib/idle_test/test_calltip.py
+++ b/Lib/idlelib/idle_test/test_calltip.py
@@ -99,6 +99,35 @@ non-overlapping occurrences o...''')
drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None,
placeholder=' [...]')''')
+ def test_properly_formated(self):
+ def foo(s='a'*100):
+ pass
+
+ def bar(s='a'*100):
+ """Hello Guido"""
+ pass
+
+ def baz(s='a'*100, z='b'*100):
+ pass
+
+ indent = calltip._INDENT
+
+ str_foo = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\
+ "aaaaaaaaaa')"
+ str_bar = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\
+ "aaaaaaaaaa')\nHello Guido"
+ str_baz = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"\
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + indent + "aaaaaaaaa"\
+ "aaaaaaaaaa', z='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"\
+ "bbbbbbbbbbbbbbbbb\n" + indent + "bbbbbbbbbbbbbbbbbbbbbb"\
+ "bbbbbbbbbbbbbbbbbbbbbb')"
+
+ self.assertEqual(calltip.get_argspec(foo), str_foo)
+ self.assertEqual(calltip.get_argspec(bar), str_bar)
+ self.assertEqual(calltip.get_argspec(baz), str_baz)
+
def test_docline_truncation(self):
def f(): pass
f.__doc__ = 'a'*300