[Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.16,1.17

gward@users.sourceforge.net gward@users.sourceforge.net
Mon, 09 Dec 2002 08:27:18 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv30201

Modified Files:
	test_textwrap.py 
Log Message:
Added test_initial_whitespace() to ensure that SF bug #622849 is fixed.
Change LongWordTestCase.setUp() -- remove leading whitespace from
  text string.
Comment fix.


Index: test_textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** test_textwrap.py	31 Oct 2002 16:11:18 -0000	1.16
--- test_textwrap.py	9 Dec 2002 16:27:15 -0000	1.17
***************
*** 225,233 ****
          self.check_split("--text--.", ["--text--."])
  
!         # I think David got this wrong in the bug report, but it can't
!         # hurt to make sure it stays right!
          self.check_split("--option", ["--option"])
          self.check_split("--option-opt", ["--option-", "opt"])
  
      def test_split(self):
          # Ensure that the standard _split() method works as advertised
--- 225,243 ----
          self.check_split("--text--.", ["--text--."])
  
!         # My initial mis-interpretation of part of the bug report --
!         # These were always handled correctly, but it can't hurt to make
!         # sure that they *stay* correct!
          self.check_split("--option", ["--option"])
          self.check_split("--option-opt", ["--option-", "opt"])
  
+     def test_initial_whitespace(self):
+         # SF bug #622849 reported inconsistent handling of leading
+         # whitespace; let's test that a bit, shall we?
+         text = " This is a sentence with leading whitespace."
+         self.check_wrap(text, 50,
+                         [" This is a sentence with leading whitespace."])
+         self.check_wrap(text, 30,
+                         [" This is a sentence with", "leading whitespace."])
+ 
      def test_split(self):
          # Ensure that the standard _split() method works as advertised
***************
*** 245,249 ****
      def setUp(self):
          self.wrapper = TextWrapper()
!         self.text = '''
  Did you say "supercalifragilisticexpialidocious?"
  How *do* you spell that odd word, anyways?
--- 255,259 ----
      def setUp(self):
          self.wrapper = TextWrapper()
!         self.text = '''\
  Did you say "supercalifragilisticexpialidocious?"
  How *do* you spell that odd word, anyways?