[Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.1,1.2

gward@users.sourceforge.net gward@users.sourceforge.net
2002年8月22日 11:35:51 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv7560
Modified Files:
	test_textwrap.py 
Log Message:
Conform to standards documented in README:
 * lowercase test*() methods
 * define test_main() and use it instead of unittest.main()
Kill #! line.
Improve some test names and docstrings.
Index: test_textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_textwrap.py	22 Aug 2002 18:11:10 -0000	1.1
--- test_textwrap.py	22 Aug 2002 18:35:49 -0000	1.2
***************
*** 1,7 ****
- #!/usr/bin/env python
- 
 import unittest
 
- # import item under test
 from textwrap import TextWrapper, wrap, fill
 
--- 1,5 ----
 import unittest
+ from test import test_support
 
 from textwrap import TextWrapper, wrap, fill
 
***************
*** 40,44 ****
 # by the unittest framework.
 
! def testSimpleCases(self):
 '''Simple case: just words, spaces, and a bit of punctuation.'''
 
--- 38,42 ----
 # by the unittest framework.
 
! def test_simple(self):
 '''Simple case: just words, spaces, and a bit of punctuation.'''
 
***************
*** 69,73 ****
 
 
! def testWhitespace(self):
 '''Whitespace munging and end-of-sentence detection.'''
 
--- 67,71 ----
 
 
! def test_whitespace(self):
 '''Whitespace munging and end-of-sentence detection.'''
 
***************
*** 96,100 ****
 
 
! def testWrappingShortToLong(self):
 '''Wrapping to make short lines longer.'''
 
--- 94,98 ----
 
 
! def test_wrap_short(self):
 '''Wrapping to make short lines longer.'''
 
***************
*** 117,121 ****
 
 
! def testHyphenated(self):
 '''Test breaking hyphenated words.'''
 
--- 115,119 ----
 
 
! def test_hyphenated(self):
 '''Test breaking hyphenated words.'''
 
***************
*** 144,148 ****
 def test_split(self):
 '''Ensure that the standard _split() method works as advertised 
! in the comments (don't you hate it when code and comments diverge?).'''
 
 t = "Hello there -- you goof-ball, use the -b option!"
--- 142,146 ----
 def test_split(self):
 '''Ensure that the standard _split() method works as advertised 
! in the comments.'''
 
 t = "Hello there -- you goof-ball, use the -b option!"
***************
*** 154,159 ****
 
 
! def testPoppins(self):
! '''Please rename this test based on its purpose.'''
 
 t = '''
--- 152,157 ----
 
 
! def test_funky_punc(self):
! '''Wrap text with long words and lots of punctuation.'''
 
 t = '''
***************
*** 180,184 ****
 
 
! def testBreakLongWordsOff(self): 
 '''Test with break_long_words disabled.'''
 t = '''
--- 178,182 ----
 
 
! def test_long_words(self): 
 '''Test with break_long_words disabled.'''
 t = '''
***************
*** 212,216 ****
 
 
! def testFill(self):
 '''Test the fill() method.'''
 
--- 210,214 ----
 
 
! def test_fill(self):
 '''Test the fill() method.'''
 
***************
*** 224,228 ****
 
 
! def testInitialIndent(self):
 '''Test initial_indent parameter.'''
 
--- 222,226 ----
 
 
! def test_initial_indent(self):
 '''Test initial_indent parameter.'''
 
***************
*** 244,248 ****
 
 
! def testSubsequentIndent(self):
 '''Test subsequent_indent parameter.'''
 
--- 242,246 ----
 
 
! def test_subsequent_indent(self):
 '''Test subsequent_indent parameter.'''
 
***************
*** 258,261 ****
 
 
 if __name__ == '__main__':
! unittest.main()
\ No newline at end of file
--- 256,265 ----
 
 
+ def test_main():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(WrapTestCase))
+ suite.addTest(unittest.makeSuite(IndentTestCases))
+ test_support.run_suite(suite)
+ 
 if __name__ == '__main__':
! test_main()

AltStyle によって変換されたページ (->オリジナル) /