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

Method test_hyphenated_numbers

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

Source from the content-addressed store, hash-verified

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.
200 text = ("Python 1.0.0 was released on 1994-01-26. Python 1.0.1 was\n"
201 "released on 1994-02-15.")
202
203 self.check_wrap(text, 30, ['Python 1.0.0 was released on',
204 '1994-01-26. Python 1.0.1 was',
205 'released on 1994-02-15.'])
206 self.check_wrap(text, 40, ['Python 1.0.0 was released on 1994-01-26.',
207 'Python 1.0.1 was released on 1994-02-15.'])
208 self.check_wrap(text, 1, text.split(), break_long_words=False)
209
210 text = "I do all my shopping at 7-11."
211 self.check_wrap(text, 25, ["I do all my shopping at",
212 "7-11."])
213 self.check_wrap(text, 27, ["I do all my shopping at",
214 "7-11."])
215 self.check_wrap(text, 29, ["I do all my shopping at 7-11."])
216 self.check_wrap(text, 1, text.split(), break_long_words=False)
217
218 def test_em_dash(self):
219 # Test text with em-dashes

Callers

nothing calls this directly

Calls 2

check_wrapMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected