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

Method test_placeholder

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

Source from the content-addressed store, hash-verified

528 max_lines=6)
529
530 def test_placeholder(self):
531 self.check_wrap(self.text, 12,
532 ["Hello..."],
533 max_lines=1,
534 placeholder='...')
535 self.check_wrap(self.text, 12,
536 ["Hello there,",
537 "how are..."],
538 max_lines=2,
539 placeholder='...')
540 # long placeholder and indentation
541 with self.assertRaises(ValueError):
542 wrap(self.text, 16, initial_indent=' ',
543 max_lines=1, placeholder=' [truncated]...')
544 with self.assertRaises(ValueError):
545 wrap(self.text, 16, subsequent_indent=' ',
546 max_lines=2, placeholder=' [truncated]...')
547 self.check_wrap(self.text, 16,
548 [" Hello there,",
549 " [truncated]..."],
550 max_lines=2,
551 initial_indent=' ',
552 subsequent_indent=' ',
553 placeholder=' [truncated]...')
554 self.check_wrap(self.text, 16,
555 [" [truncated]..."],
556 max_lines=1,
557 initial_indent=' ',
558 subsequent_indent=' ',
559 placeholder=' [truncated]...')
560 self.check_wrap(self.text, 80, [self.text], placeholder='.' * 1000)
561
562 def test_placeholder_backtrack(self):
563 # Test special case when max_lines insufficient, but what

Callers

nothing calls this directly

Calls 3

wrapFunction · 0.90
check_wrapMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected