• Home
  • Raw
  • Download

Lines Matching +full:no +full:- +full:trailing +full:- +full:spaces

24             result = "\n".join(result) if result else "  no lines"
52 # Simple case: just words, spaces, and a bit of punctuation
79 # Whitespace munging and end-of-sentence detection
175 text = ("this-is-a-useful-feature-for-"
176 "reformatting-posts-from-tim-peters'ly")
179 ["this-is-a-useful-feature-for-",
180 "reformatting-posts-from-tim-peters'ly"])
182 ["this-is-a-useful-feature-for-",
183 "reformatting-posts-from-tim-peters'ly"])
185 ["this-is-a-useful-feature-for-reformatting-",
186 "posts-from-tim-peters'ly"])
188 expect = ("this-|is-|a-|useful-|feature-|for-|"
189 "reformatting-|posts-|from-|tim-|peters'ly").split('|')
193 self.check_split('e-mail', ['e-mail'])
194 self.check_split('Jelly-O', ['Jelly-O'])
196 self.check_split('half-a-crown', 'half-|a-|crown'.split('|'))
200 text = ("Python 1.0.0 was released on 1994-01-26. Python 1.0.1 was\n"
201 "released on 1994-02-15.")
204 '1994-01-26. Python 1.0.1 was',
205 'released on 1994-02-15.'])
206 self.check_wrap(text, 40, ['Python 1.0.0 was released on 1994-01-26.',
207 'Python 1.0.1 was released on 1994-02-15.'])
210 text = "I do all my shopping at 7-11."
212 "7-11."])
214 "7-11."])
215 self.check_wrap(text, 29, ["I do all my shopping at 7-11."])
219 # Test text with em-dashes
220 text = "Em-dashes should be written -- thus."
222 ["Em-dashes should be",
223 "written -- thus."])
225 # Probe the boundaries of the properly written em-dash,
226 # ie. " -- ".
228 ["Em-dashes should be written",
229 "-- thus."])
230 expect = ["Em-dashes should be written --",
235 ["Em-dashes should be written -- thus."])
237 # The improperly written em-dash is handled too, because
238 # it's adjacent to non-whitespace on both sides.
239 text = "You can also do--this or even---this."
241 "--this or even",
242 "---this."]
245 expect = ["You can also do--",
246 "this or even---",
250 expect = ["You can also do--this or even",
251 "---this."]
254 expect = ["You can also do--this or even---",
261 text = "Here's an -- em-dash and--here's another---and another!"
262 expect = ["Here's", " ", "an", " ", "--", " ", "em-", "dash", " ",
263 "and", "--", "here's", " ", "another", "---",
267 text = "and then--bam!--he was gone"
268 expect = ["and", " ", "then", "--", "bam!", "--",
274 # Test that Unix-style command-line options are wrapped correctly.
277 text = "You should use the -n option, or --dry-run in its long form."
280 "-n option, or --dry-",
284 ["You should use the -n",
285 "option, or --dry-run",
287 expect = ["You should use the -n option, or",
288 "--dry-run in its long form."]
293 expect = ["You should use the -n option, or --dry-",
297 expect = ["You should use the -n option, or --dry-run",
302 text = "the -n option, or --dry-run or --dryrun"
303 expect = ["the", " ", "-n", " ", "option,", " ", "or", " ",
304 "--dry-", "run", " ", "or", " ", "--dryrun"]
310 self.check_split("what the--hey!", ["what", " ", "the", "--", "hey!"])
311 self.check_split("what the--", ["what", " ", "the--"])
312 self.check_split("what the--.", ["what", " ", "the--."])
313 self.check_split("--text--.", ["--text--."])
319 self.check_split("--option", ["--option"])
320 self.check_split("--option-opt", ["--option-", "opt"])
321 self.check_split("foo --option-opt bar",
322 ["foo", " ", "--option-", "opt", " ", "bar"])
325 # Oh bother, SF #965425 found another problem with hyphens --
328 # word was handled incorrectly, except for a leading "--", which
329 # was special-cased for Optik and Docutils. So test a variety
332 self.check_split("the 'wibble-wobble' widget",
333 ['the', ' ', "'wibble-", "wobble'", ' ', 'widget'])
334 self.check_split('the "wibble-wobble" widget',
335 ['the', ' ', '"wibble-', 'wobble"', ' ', 'widget'])
336 self.check_split("the (wibble-wobble) widget",
337 ['the', ' ', "(wibble-", "wobble)", ' ', 'widget'])
338 self.check_split("the ['wibble-wobble'] widget",
339 ['the', ' ', "['wibble-", "wobble']", ' ', 'widget'])
342 self.check_split("what-d'you-call-it.",
343 "what-d'you-|call-|it.".split('|'))
348 self.check_split("foo (--option) bar",
349 ["foo", " ", "(--option)", " ", "bar"])
351 # Related stuff -- make sure parens work in simpler contexts.
368 # Check that drop_whitespace=False preserves a whitespace-only string.
372 # Check that a whitespace-only string gets indented (when
378 # Check drop_whitespace on a whitespace-only string.
383 # followed by non-whitespace).
393 # Check that drop_whitespace skips the whole line if a non-leading
402 # Check that initial_indent is not applied to a whitespace-only
418 text = "Hello there -- you goof-ball, use the -b option!"
422 ["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-",
423 "ball,", " ", "use", " ", "the", " ", "-b", " ", "option!"])
427 text = "yaba daba-doo"
428 self.check_wrap(text, 10, ["yaba daba-", "doo"],
430 self.check_wrap(text, 10, ["yaba", "daba-doo"],
437 self.assertRaises(ValueError, wrap, text, -1)
440 text = "Die Empf\xe4nger-Auswahl"
441 self.check_wrap(text, 13, ["Die", "Empf\xe4nger-", "Auswahl"])
444 text = "aa \xe4\xe4-\xe4\xe4"
445 self.check_wrap(text, 7, ["aa \xe4\xe4-", "\xe4\xe4"])
448 text = 'This is a sentence with non-breaking\N{NO-BREAK SPACE}space.'
452 'with non-',
453 'breaking\N{NO-BREAK SPACE}space.'],
459 'non-breaking\N{NO-BREAK SPACE}space.'],
463 text = ('This is a sentence with non-breaking'
464 '\N{NARROW NO-BREAK SPACE}space.')
468 'with non-',
469 'breaking\N{NARROW NO-BREAK SPACE}space.'],
475 'non-breaking\N{NARROW NO-BREAK SPACE}space.'],
508 # strip spaces before placeholder
520 # final spaces
596 self.check_wrap('-'*10+'hello', 10,
597 ['----------',
697 """assert that dedent() has no effect on 'text'"""
701 # No lines indented.
718 # All lines indented by two spaces.
752 # Uneven indentation with a whitespace-only line.
759 text = " Foo\n Bar\n" # 5 spaces, then 4
764 text = " Foo\n\n Bar\n" # 5 spaces, blank, then 4
769 text = " Foo\n \n Bar\n" # 5 spaces, then 4, then 4
784 # tabs and spaces both count as margin, but are *not*
790 # same effect even if we have 8 spaces
826 # Include leading and trailing blank lines
883 # Include leading and trailing blank lines
901 # Include leading and trailing blank lines
912 # Add 'prefix' to all lines, including whitespace-only ones.
919 # Include leading and trailing blank lines
931 # Add 'prefix' solely to whitespace-only lines.
938 # Include leading and trailing blank lines
957 # Simple case: just words, spaces, and a bit of punctuation
962 self.check_shorten(text, len(text) - 1,
973 self.check_shorten(text, len(text) - 1,