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

Method test_whitespace

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

Source from the content-addressed store, hash-verified

1107 self.check_shorten("", 6, "")
1108
1109 def test_whitespace(self):
1110 # Whitespace collapsing
1111 text = """
1112 This is a paragraph that already has
1113 line breaks and \t tabs too."""
1114 self.check_shorten(text, 62,
1115 "This is a paragraph that already has line "
1116 "breaks and tabs too.")
1117 self.check_shorten(text, 61,
1118 "This is a paragraph that already has line "
1119 "breaks and [...]")
1120
1121 self.check_shorten("hello world! ", 12, "hello world!")
1122 self.check_shorten("hello world! ", 11, "hello [...]")
1123 # The leading space is trimmed from the placeholder
1124 # (it would be ugly otherwise).
1125 self.check_shorten("hello world! ", 10, "[...]")
1126
1127 def test_width_too_small_for_placeholder(self):
1128 shorten("x" * 20, width=8, placeholder="(......)")

Callers

nothing calls this directly

Calls 1

check_shortenMethod · 0.95

Tested by

no test coverage detected