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

Method test_hyphenated

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

Source from the content-addressed store, hash-verified

170
171
172 def test_hyphenated(self):
173 # Test breaking hyphenated words
174
175 text = ("this-is-a-useful-feature-for-"
176 "reformatting-posts-from-tim-peters'ly")
177
178 self.check_wrap(text, 40,
179 ["this-is-a-useful-feature-for-",
180 "reformatting-posts-from-tim-peters'ly"])
181 self.check_wrap(text, 41,
182 ["this-is-a-useful-feature-for-",
183 "reformatting-posts-from-tim-peters'ly"])
184 self.check_wrap(text, 42,
185 ["this-is-a-useful-feature-for-reformatting-",
186 "posts-from-tim-peters'ly"])
187 # The test tests current behavior but is not testing parts of the API.
188 expect = ("this-|is-|a-|useful-|feature-|for-|"
189 "reformatting-|posts-|from-|tim-|peters'ly").split('|')
190 self.check_wrap(text, 1, expect, break_long_words=False)
191 self.check_split(text, expect)
192
193 self.check_split('e-mail', ['e-mail'])
194 self.check_split('Jelly-O', ['Jelly-O'])
195 # The test tests current behavior but is not testing parts of the API.
196 self.check_split('half-a-crown', 'half-|a-|crown'.split('|'))
197
198 def test_hyphenated_numbers(self):
199 # Test that hyphenated numbers (eg. dates) are not broken like words.

Callers

nothing calls this directly

Calls 3

check_wrapMethod · 0.80
check_splitMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected