MCPcopy
hub / github.com/django/django / test_wrap

Method test_wrap

tests/utils_tests/test_text.py:315–332  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

313 self.assertEqual(truncator.words(4, html=True), "hello >< world")
314
315 def test_wrap(self):
316 digits = "1234 67 9"
317 self.assertEqual(text.wrap(digits, 100), "1234 67 9")
318 self.assertEqual(text.wrap(digits, 9), "1234 67 9")
319 self.assertEqual(text.wrap(digits, 8), "1234 67\n9")
320
321 self.assertEqual(text.wrap("short\na long line", 7), "short\na long\nline")
322 self.assertEqual(
323 text.wrap("do-not-break-long-words please? ok", 8),
324 "do-not-break-long-words\nplease?\nok",
325 )
326
327 long_word = "l%sng" % ("o" * 20)
328 self.assertEqual(text.wrap(long_word, 20), long_word)
329 self.assertEqual(
330 text.wrap("a %s word" % long_word, 10), "a\n%s\nword" % long_word
331 )
332 self.assertEqual(text.wrap(lazystr(digits), 100), "1234 67 9")
333
334 def test_normalize_newlines(self):
335 self.assertEqual(

Callers

nothing calls this directly

Calls 2

lazystrFunction · 0.90
wrapMethod · 0.45

Tested by

no test coverage detected