[Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.6,1.7

gward@users.sourceforge.net gward@users.sourceforge.net
Thu, 22 Aug 2002 12:02:41 -0700


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

Modified Files:
	test_textwrap.py 
Log Message:
Factor LongWordTestCase out of WrapTestCase, and rename its methods
(tests) from test_funky_punc() to test_break_long() and
test_long_words() to test_nobreak_long().


Index: test_textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_textwrap.py	22 Aug 2002 18:57:26 -0000	1.6
--- test_textwrap.py	22 Aug 2002 19:02:37 -0000	1.7
***************
*** 125,151 ****
  
  
!     def test_funky_punc(self):
!         '''Wrap text with long words and lots of punctuation.'''
! 
!         text = '''
  Did you say "supercalifragilisticexpialidocious?"
  How *do* you spell that odd word, anyways?
  '''
!         self.check_wrap(text, 30,
                          ['Did you say "supercalifragilis',
                           'ticexpialidocious?" How *do*',
                           'you spell that odd word,',
                           'anyways?'])
!         self.check_wrap(text, 50,
                          ['Did you say "supercalifragilisticexpialidocious?"',
                           'How *do* you spell that odd word, anyways?'])
  
  
!     def test_long_words(self):        
          '''Test with break_long_words disabled.'''
-         text = '''
- Did you say "supercalifragilisticexpialidocious?"
- How *do* you spell that odd word, anyways?
- '''
          self.wrapper.break_long_words = 0
          self.wrapper.width = 30
--- 125,151 ----
  
  
! class LongWordTestCase (BaseTestCase):
!     def setUp(self):
!         self.wrapper = TextWrapper()
!         self.text = '''
  Did you say "supercalifragilisticexpialidocious?"
  How *do* you spell that odd word, anyways?
  '''
! 
!     def test_break_long(self):
!         '''Wrap text with long words and lots of punctuation.'''
! 
!         self.check_wrap(self.text, 30,
                          ['Did you say "supercalifragilis',
                           'ticexpialidocious?" How *do*',
                           'you spell that odd word,',
                           'anyways?'])
!         self.check_wrap(self.text, 50,
                          ['Did you say "supercalifragilisticexpialidocious?"',
                           'How *do* you spell that odd word, anyways?'])
  
  
!     def test_nobreak_long(self):        
          '''Test with break_long_words disabled.'''
          self.wrapper.break_long_words = 0
          self.wrapper.width = 30
***************
*** 155,163 ****
                    'word, anyways?'
                    ] 
!         result = self.wrapper.wrap(text)
          self.check(result, expect)
  
          # Same thing with kwargs passed to standalone wrap() function.
!         result = wrap(text, width=30, break_long_words=0)
          self.check(result, expect)
  
--- 155,163 ----
                    'word, anyways?'
                    ] 
!         result = self.wrapper.wrap(self.text)
          self.check(result, expect)
  
          # Same thing with kwargs passed to standalone wrap() function.
!         result = wrap(self.text, width=30, break_long_words=0)
          self.check(result, expect)
  
***************
*** 222,225 ****
--- 222,226 ----
      suite = unittest.TestSuite()
      suite.addTest(unittest.makeSuite(WrapTestCase))
+     suite.addTest(unittest.makeSuite(LongWordTestCase))
      suite.addTest(unittest.makeSuite(IndentTestCases))
      test_support.run_suite(suite)