@@ -93,24 +93,20 @@ class SB: __call__ = None
9393non-overlapping occurrences of the pattern in string by the
9494replacement repl. repl can be either a string or a callable;
9595if a string, backslash escapes in it are processed. If it is
96- a callable, it's passed the Match object and must return''' )
96+ a callable, it's passed the Match object and must return
97+ a replacement string to be used.''' )
9798 tiptest (p .sub , '''\
9899 (repl, string, count=0)
99- Return the string obtained by replacing the leftmost \
100- non-overlapping occurrences o.. .''' )
100+ Return the string obtained by replacing the leftmost non-overlapping \
101+ occurrences of pattern in string by the replacement repl .''' )
101102
102- def test_signature_wrap (self ):
103+ def test_signature (self ):
103104 if textwrap .TextWrapper .__doc__ is not None :
104- self .assertEqual (get_spec (textwrap .TextWrapper ), '''\
105- (width=70, initial_indent='', subsequent_indent='', expand_tabs=True,
106- replace_whitespace=True, fix_sentence_endings=False, break_long_words=True,
107- drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None,
108- placeholder=' [...]')
109- Object for wrapping/filling text. The public interface consists of
110- the wrap() and fill() methods; the other methods are just there for
111- subclasses to override in order to tweak the default behaviour.
112- If you want to completely replace the main wrapping algorithm,
113- you\' ll probably have to override _wrap_chunks().''' )
105+ self .assertEqual (get_spec (textwrap .TextWrapper ).split ('\n ' )[0 ], '''\
106+ (width=70, initial_indent='', subsequent_indent='', expand_tabs=True, \
107+ replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, \
108+ drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, \
109+ placeholder=' [...]')''' )
114110
115111 def test_properly_formatted (self ):
116112
@@ -127,16 +123,14 @@ def baz(s='a'*100, z='b'*100):
127123 indent = calltip ._INDENT
128124
129125 sfoo = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
130- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n " + indent + "aaaaaaaaa" \
131- "aaaaaaaaaa')"
126+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')"
132127 sbar = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
133- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \n " + indent + "aaaaaaaaa " \
134- "aaaaaaaaaa') \n Hello Guido"
128+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') " \
129+ "\n Hello Guido"
135130 sbaz = "(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
136- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n " + indent + "aaaaaaaaa" \
137- "aaaaaaaaaa', z='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" \
138- "bbbbbbbbbbbbbbbbb\n " + indent + "bbbbbbbbbbbbbbbbbbbbbb" \
139- "bbbbbbbbbbbbbbbbbbbbbb')"
131+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'," \
132+ " z='bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" \
133+ "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb')"
140134
141135 for func ,doc in [(foo , sfoo ), (bar , sbar ), (baz , sbaz )]:
142136 with self .subTest (func = func , doc = doc ):
@@ -145,29 +139,7 @@ def baz(s='a'*100, z='b'*100):
145139 def test_docline_truncation (self ):
146140 def f (): pass
147141 f .__doc__ = 'a' * 300
148- self .assertEqual (get_spec (f ), f"()\n { 'a' * (calltip ._MAX_COLS - 3 ) + '...' } " )
149-
150- @unittest .skipIf (MISSING_C_DOCSTRINGS ,
151- "Signature information for builtins requires docstrings" )
152- def test_multiline_docstring (self ):
153- # Test fewer lines than max.
154- self .assertEqual (get_spec (range ),
155- "range(stop) -> range object\n "
156- "range(start, stop[, step]) -> range object" )
157-
158- # Test max lines
159- self .assertEqual (get_spec (bytes ), '''\
160- bytes(iterable_of_ints) -> bytes
161- bytes(string, encoding[, errors]) -> bytes
162- bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
163- bytes(int) -> bytes object of size given by the parameter initialized with null bytes
164- bytes() -> empty bytes object''' )
165-
166- def test_multiline_docstring_2 (self ):
167- # Test more than max lines
168- def f (): pass
169- f .__doc__ = 'a\n ' * 15
170- self .assertEqual (get_spec (f ), '()' + '\n a' * calltip ._MAX_LINES )
142+ self .assertEqual (get_spec (f ), "()\n %s" % ('a' * 300 ))
171143
172144 def test_functions (self ):
173145 def t1 (): 'doc'
0 commit comments