]> granicus.if.org Git - python/commitdiff
Merge heads.
authorTerry Jan Reedy <tjreedy@udel.edu>
Mon, 27 Jan 2014 01:16:53 +0000 (20:16 -0500)
committerTerry Jan Reedy <tjreedy@udel.edu>
Mon, 27 Jan 2014 01:16:53 +0000 (20:16 -0500)
1  2 
Lib/idlelib/idle_test/test_calltips.py

index 5b51732b2dfdfea77dec72f3c9aed1cb0b97f46b,f27994f3f97c3dd884e7696d5484cf2d5387c612..4bf5e7e5dc20e48b5cb8d02a0c4fd6090ee948f2
@@@ -61,26 -62,40 +62,39 @@@ class Get_signatureTest(unittest.TestCa
          gtest([].append, append_doc)
          gtest(List.append, append_doc)
  
-         gtest(types.MethodType, "Create a bound instance method object.")
+         gtest(types.MethodType, "method(function, instance)")
          gtest(SB(), default_tip)
  
 -        #print(signature(textwrap.TextWrapper))
+     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, *, max_lines=None,
+     placeholder=' [...]')''')
+     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(dict),
-                 "dict(mapping) -> new dictionary initialized from a mapping object's\n"
-                 "(key, value) pairs\n"
-                 "dict(iterable) -> new dictionary initialized as if via:\n"
-                 "d = {}\n"
-                 "for k, v in iterable:"
-                 )
-         # Test max lines and line (currently) too long.
-         self.assertEqual(signature(bytes),
- "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")
+         self.assertEqual(signature(list),
+                 "list() -> new empty list\n"
+                 "list(iterable) -> new list initialized from iterable's items")
+         # 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'