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

Method test_punct_hyphens

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

Source from the content-addressed store, hash-verified

322 ["foo", " ", "--option-", "opt", " ", "bar"])
323
324 def test_punct_hyphens(self):
325 # Oh bother, SF #965425 found another problem with hyphens --
326 # hyphenated words in single quotes weren't handled correctly.
327 # In fact, the bug is that *any* punctuation around a hyphenated
328 # word was handled incorrectly, except for a leading "--", which
329 # was special-cased for Optik and Docutils. So test a variety
330 # of styles of punctuation around a hyphenated word.
331 # (Actually this is based on an Optik bug report, #813077).
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'])
340
341 # The test tests current behavior but is not testing parts of the API.
342 self.check_split("what-d'you-call-it.",
343 "what-d'you-|call-|it.".split('|'))
344
345 def test_funky_parens (self):
346 # Second part of SF bug #596434: long option strings inside

Callers

nothing calls this directly

Calls 2

check_splitMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected