[Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.14,1.15

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Wed, 02 Oct 2002 08:47:34 -0700


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

Modified Files:
	test_textwrap.py 
Log Message:
Fix an endcase bug: initial_indent was ignored when the text was short
enough to fit in one line.


Index: test_textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_textwrap.py	22 Aug 2002 21:27:05 -0000	1.14
--- test_textwrap.py	2 Oct 2002 15:47:32 -0000	1.15
***************
*** 34,42 ****
                  self.show(expect), self.show(result)))
  
!     def check_wrap (self, text, width, expect):
!         result = wrap(text, width)
          self.check(result, expect)
  
!     def check_split (self, wrapper, text, expect):
          result = wrapper._split(text)
          self.assertEquals(result, expect,
--- 34,42 ----
                  self.show(expect), self.show(result)))
  
!     def check_wrap(self, text, width, expect, **kwargs):
!         result = wrap(text, width, **kwargs)
          self.check(result, expect)
  
!     def check_split(self, wrapper, text, expect):
          result = wrapper._split(text)
          self.assertEquals(result, expect,
***************
*** 100,103 ****
--- 100,113 ----
                                     "paragraph."])
          self.check_wrap(text, 40, ["This is a short paragraph."])
+ 
+ 
+     def test_wrap_short_1line(self):
+         # Test endcases
+ 
+         text = "This is a short line."
+ 
+         self.check_wrap(text, 30, ["This is a short line."])
+         self.check_wrap(text, 30, ["(1) This is a short line."],
+                         initial_indent="(1) ")