[Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.12,1.13
gward@users.sourceforge.net
gward@users.sourceforge.net
Thu, 22 Aug 2002 14:16:28 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv17027
Modified Files:
test_textwrap.py
Log Message:
Factored out BaseTestCase.check_split() method -- use it wherever
we need to test TextWrapper._split().
Index: test_textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** test_textwrap.py 22 Aug 2002 21:12:54 -0000 1.12
--- test_textwrap.py 22 Aug 2002 21:16:25 -0000 1.13
***************
*** 38,41 ****
--- 38,47 ----
self.check(result, expect)
+ def check_split (self, wrapper, text, expect):
+ result = wrapper._split(text)
+ self.assertEquals(result, expect,
+ "\nexpected %r\n"
+ "but got %r" % (expect, result))
+
class WrapTestCase(BaseTestCase):
***************
*** 156,166 ****
# _split() method.
text = "Here's an -- em-dash and--here's another---and another!"
- result = self.wrapper._split(text)
expect = ["Here's", " ", "an", " ", "--", " ", "em-", "dash", " ",
"and", "--", "here's", " ", "another", "---",
"and", " ", "another!"]
! self.assertEquals(result, expect,
! "\nexpected %r\n"
! "but got %r" % (expect, result))
def test_unix_options (self):
--- 162,169 ----
# _split() method.
text = "Here's an -- em-dash and--here's another---and another!"
expect = ["Here's", " ", "an", " ", "--", " ", "em-", "dash", " ",
"and", "--", "here's", " ", "another", "---",
"and", " ", "another!"]
! self.check_split(self.wrapper, text, expect)
def test_unix_options (self):
***************
*** 194,203 ****
# Again, all of the above can be deduced from _split().
text = "the -n option, or --dry-run or --dryrun"
- result = self.wrapper._split(text)
expect = ["the", " ", "-n", " ", "option,", " ", "or", " ",
"--dry-", "run", " ", "or", " ", "--dryrun"]
! self.assertEquals(result, expect,
! "\nexpected %r\n"
! "but got %r" % (expect, result))
def test_split(self):
--- 197,203 ----
# Again, all of the above can be deduced from _split().
text = "the -n option, or --dry-run or --dryrun"
expect = ["the", " ", "-n", " ", "option,", " ", "or", " ",
"--dry-", "run", " ", "or", " ", "--dryrun"]
! self.check_split(self.wrapper, text, expect)
def test_split(self):