[Python-checkins] python/dist/src/Lib/test test_textwrap.py, 1.22.8.1, 1.22.8.2 (original) (raw)

gward at users.sourceforge.net gward at users.sourceforge.net
Wed May 12 21:45:39 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3585/Lib/test

Modified Files: Tag: release23-maint test_textwrap.py Log Message: SF #847346: add test_fix_sentence_endings() to ensure that sentence endings get fixed even if the input is too short to wrap. Also throw in a bunch of other tests for this rather tricky and under-tested feature.

In WrapTestCase.setUp(), don't bother setting fix_sentence_endings=True for self.wrapper -- just use a separate wrapper in the two tests that care about it, namely test_whitespace() and test_fix_sentence_endings().

Index: test_textwrap.py

RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.22.8.1 retrieving revision 1.22.8.2 diff -C2 -d -r1.22.8.1 -r1.22.8.2 *** test_textwrap.py 30 Aug 2003 14:52:35 -0000 1.22.8.1 --- test_textwrap.py 13 May 2004 01:45:33 -0000 1.22.8.2


*** 48,52 ****

  def setUp(self):

! self.wrapper = TextWrapper(width=45, fix_sentence_endings=True)

  def test_simple(self):

--- 48,52 ----

  def setUp(self):

! self.wrapper = TextWrapper(width=45)

  def test_simple(self):

*** 85,95 **** "mess!"]

! result = self.wrapper.wrap(text) self.check(result, expect)

! result = self.wrapper.fill(text) self.check(result, '\n'.join(expect))

  def test_wrap_short(self):
      # Wrapping to make short lines longer

--- 85,133 ---- "mess!"]

! wrapper = TextWrapper(45, fix_sentence_endings=True) ! result = wrapper.wrap(text) self.check(result, expect)

! result = wrapper.fill(text) self.check(result, '\n'.join(expect))



More information about the Python-checkins mailing list