MCPcopy Index your code
hub / github.com/python/cpython / test_unix_options

Method test_unix_options

Lib/test/test_textwrap.py:273–305  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

271
272
273 def test_unix_options (self):
274 # Test that Unix-style command-line options are wrapped correctly.
275 # Both Optik (OptionParser) and Docutils rely on this behaviour!
276
277 text = "You should use the -n option, or --dry-run in its long form."
278 self.check_wrap(text, 20,
279 ["You should use the",
280 "-n option, or --dry-",
281 "run in its long",
282 "form."])
283 self.check_wrap(text, 21,
284 ["You should use the -n",
285 "option, or --dry-run",
286 "in its long form."])
287 expect = ["You should use the -n option, or",
288 "--dry-run in its long form."]
289 self.check_wrap(text, 32, expect)
290 self.check_wrap(text, 34, expect)
291 self.check_wrap(text, 35, expect)
292 self.check_wrap(text, 38, expect)
293 expect = ["You should use the -n option, or --dry-",
294 "run in its long form."]
295 self.check_wrap(text, 39, expect)
296 self.check_wrap(text, 41, expect)
297 expect = ["You should use the -n option, or --dry-run",
298 "in its long form."]
299 self.check_wrap(text, 42, expect)
300
301 # Again, all of the above can be deduced from _split().
302 text = "the -n option, or --dry-run or --dryrun"
303 expect = ["the", " ", "-n", " ", "option,", " ", "or", " ",
304 "--dry-", "run", " ", "or", " ", "--dryrun"]
305 self.check_split(text, expect)
306
307 def test_funky_hyphens (self):
308 # Screwy edge cases cooked up by David Goodger. All reported

Callers

nothing calls this directly

Calls 2

check_wrapMethod · 0.80
check_splitMethod · 0.80

Tested by

no test coverage detected