]> granicus.if.org Git - python/commitdiff
Merged revisions 75072 via svnmerge from
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 26 Sep 2009 12:27:13 +0000 (12:27 +0000)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 26 Sep 2009 12:27:13 +0000 (12:27 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r75072 | ezio.melotti | 2009-09-26 15:19:30 +0300 (Sat, 26 Sep 2009) | 1 line

  string.capwords is still around, adding back the tests
........

Lib/test/test_string.py

index 16d1edb0e388cc362a1338f2bde6a75d67364910..743fa6b27fe8df82cbd776e6d5754243f17708cd 100644 (file)
@@ -15,6 +15,14 @@ class ModuleTest(unittest.TestCase):
         string.punctuation
         string.printable
 
+    def test_capwords(self):
+        self.assertEqual(string.capwords('abc def ghi'), 'Abc Def Ghi')
+        self.assertEqual(string.capwords('abc\tdef\nghi'), 'Abc Def Ghi')
+        self.assertEqual(string.capwords('abc\t   def  \nghi'), 'Abc Def Ghi')
+        self.assertEqual(string.capwords('ABC DEF GHI'), 'Abc Def Ghi')
+        self.assertEqual(string.capwords('ABC-DEF-GHI', '-'), 'Abc-Def-Ghi')
+        self.assertEqual(string.capwords('ABC-def DEF-ghi GHI'), 'Abc-def Def-ghi Ghi')
+
     def test_formatter(self):
         fmt = string.Formatter()
         self.assertEqual(fmt.format("foo"), "foo")