diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-01-26 19:55:34 -0500 |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-01-26 19:55:34 -0500 |
commit | 4e3450594ea5d1aea173d1b39825b675f1847b16 (patch) | |
tree | e34abc9313d6701a8260acbf9eb7e019bc0a6ade /Lib/idlelib/idle_test/test_calltips.py | |
parent | e36b2a125bf471d36e5d0afe2f44c48e500775dd (diff) | |
download | cpython-4e3450594ea5d1aea173d1b39825b675f1847b16.tar.gz |
Issue #20338: Increase allowed tip width slightly and wrap long signagure lines.
Original patch by Serhiy Storchaka.
Diffstat (limited to 'Lib/idlelib/idle_test/test_calltips.py')
-rw-r--r-- | Lib/idlelib/idle_test/test_calltips.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/Lib/idlelib/idle_test/test_calltips.py b/Lib/idlelib/idle_test/test_calltips.py index eca24ec129..e71656b6ae 100644 --- a/Lib/idlelib/idle_test/test_calltips.py +++ b/Lib/idlelib/idle_test/test_calltips.py @@ -1,5 +1,6 @@ import unittest import idlelib.CallTips as ct +import textwrap import types default_tip = ct._default_callable_argspec @@ -64,20 +65,35 @@ class Get_signatureTest(unittest.TestCase): gtest(types.MethodType, "method(function, instance)") gtest(SB(), default_tip) + def test_signature_wrap(self): + self.assertEqual(signature(textwrap.TextWrapper), '''\ +(width=70, initial_indent='', subsequent_indent='', expand_tabs=True, + replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, + drop_whitespace=True, break_on_hyphens=True, tabsize=8)''') + + def test_docline_truncation(self): + def f(): pass + f.__doc__ = 'a'*300 + self.assertEqual(signature(f), '()\n' + 'a' * (ct._MAX_COLS-3) + '...') + def test_multiline_docstring(self): # Test fewer lines than max. self.assertEqual(signature(list), "list() -> new empty list\n" "list(iterable) -> new list initialized from iterable's items") - # Test max lines and line (currently) too long. - self.assertEqual(signature(bytes), -"bytes(iterable_of_ints) -> bytes\n" -"bytes(string, encoding[, errors]) -> bytes\n" -"bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\n" -#bytes(int) -> bytes object of size given by the parameter initialized with null bytes -"bytes(int) -> bytes object of size given by the parameter initialized with n...\n" -"bytes() -> empty bytes object") + # Test max lines + self.assertEqual(signature(bytes), '''\ +bytes(iterable_of_ints) -> bytes +bytes(string, encoding[, errors]) -> bytes +bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer +bytes(int) -> bytes object of size given by the parameter initialized with null bytes +bytes() -> empty bytes object''') + + # Test more than max lines + def f(): pass + f.__doc__ = 'a\n' * 15 + self.assertEqual(signature(f), '()' + '\na' * ct._MAX_LINES) def test_functions(self): def t1(): 'doc' |