[Python-checkins] python/dist/src/Lib/test test_textwrap.py, 1.25, 1.26

gward at users.sourceforge.net gward at users.sourceforge.net
Wed Jun 2 21:59:43 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12903/Lib/test

Modified Files:
	test_textwrap.py 
Log Message:
SF #965425: fix so hyphenated words surrounded by punctuation are
wrapped correctly.


Index: test_textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** test_textwrap.py	13 May 2004 01:53:08 -0000	1.25
--- test_textwrap.py	3 Jun 2004 01:59:41 -0000	1.26
***************
*** 1,4 ****
  #
! # Test script for the textwrap module.
  #
  # Original tests written by Greg Ward <gward at python.net>.
--- 1,4 ----
  #
! # Test suite for the textwrap module.
  #
  # Original tests written by Greg Ward <gward at python.net>.
***************
*** 272,275 ****
--- 272,292 ----
                           ["foo", " ", "--option-", "opt", " ", "bar"])
  
+     def test_punct_hyphens(self):
+         # Oh bother, SF #965425 found another problem with hyphens --
+         # hyphenated words in single quotes weren't handled correctly.
+         # In fact, the bug is that *any* punctuation around a hyphenated
+         # word was handled incorrectly, except for a leading "--", which
+         # was special-cased for Optik and Docutils.  So test a variety
+         # of styles of punctuation around a hyphenated word.
+         # (Actually this is based on an Optik bug report, #813077).
+         self.check_split("the 'wibble-wobble' widget",
+                          ['the', ' ', "'wibble-", "wobble'", ' ', 'widget'])
+         self.check_split('the "wibble-wobble" widget',
+                          ['the', ' ', '"wibble-', 'wobble"', ' ', 'widget'])
+         self.check_split("the (wibble-wobble) widget",
+                          ['the', ' ', "(wibble-", "wobble)", ' ', 'widget'])
+         self.check_split("the ['wibble-wobble'] widget",
+                          ['the', ' ', "['wibble-", "wobble']", ' ', 'widget'])
+ 
      def test_funky_parens (self):
          # Second part of SF bug #596434: long option strings inside




More information about the Python-checkins mailing list