Commit ab54b9a1 authored by Emmanuel Arias's avatar Emmanuel Arias Committed by Terry Jan Reedy

bpo-35641: IDLE - format calltip properly when no docstring (GH-11415)

parent aff0adab
...@@ -99,6 +99,35 @@ non-overlapping occurrences o...''') ...@@ -99,6 +99,35 @@ non-overlapping occurrences o...''')
drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None,
placeholder=' [...]')''') 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 test_docline_truncation(self):
def f(): pass def f(): pass
f.__doc__ = 'a'*300 f.__doc__ = 'a'*300
......
...@@ -60,6 +60,7 @@ Heidi Annexstad ...@@ -60,6 +60,7 @@ Heidi Annexstad
Ramchandra Apte Ramchandra Apte
Éric Araujo Éric Araujo
Alexandru Ardelean Alexandru Ardelean
Emmanuel Arias
Alicia Arlen Alicia Arlen
Jeffrey Armstrong Jeffrey Armstrong
Jason Asbahr Jason Asbahr
......
Proper format `calltip` when the function has no docstring.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment