Пример #1
0
 def testSplitString(self):
     s1 = PyString.py_string()
     inpt = "one two three four five.  Six seven eight?"
     expected = [
         'one', 'two', 'three', 'four', 'five.', '', 'Six', 'seven',
         'eight?'
     ]
     self.assertEqual(expected, s1.splitString(inpt, " "))
Пример #2
0
 def testStringReplace(self):
     s1 = PyString.py_string()
     original = "two"
     replacement = "twelve"
     maxreplace = 2
     text = "one two three four five two.  Six seven eight two?"
     expected = "one twelve three four five twelve.  Six seven eight two?"
     self.assertEqual(
         expected, s1.stringReplace(text, original, replacement,
                                    maxreplace))
Пример #3
0
 def testReverseSimple(self):
     s1 = PyString.py_string()
     inpt = "aBcDeF123"
     expected = "321FeDcBa"
     self.assertEqual(expected, s1.reverseSimple(inpt))
Пример #4
0
 def testStrngJoin(self):
     s1 = PyString.py_string()
     separator = "+"
     seq = ("one", "two", "three", "four")
     expected = "one+two+three+four"
     self.assertEqual(expected, s1.stringJoin(separator, seq))
Пример #5
0
 def testMakeCaps(self):
     s1 = PyString.py_string()
     inpt = "one two three four five.  four five six."
     expected = "One two three four five.  four five six."
     self.assertEqual(expected, s1.makeCaps(inpt))
Пример #6
0
 def testMakeLower(self):
     s1 = PyString.py_string()
     inpt = "ZyXwVuTs9876"
     expected = "zyxwvuts9876"
     self.assertEqual(expected, s1.makeLower(inpt))
Пример #7
0
 def testMakeUpper(self):
     s1 = PyString.py_string()
     inpt = "ZyXwVuTs9876"
     expected = "ZYXWVUTS9876"
     self.assertEqual(expected, s1.makeUpper(inpt))
Пример #8
0
 def testReverse(self):
     s1 = PyString.py_string()
     inpt = "ZyXwVuTs9876"
     expected = "6789sTuVwXyZ"
     self.assertEqual(expected, s1.reverse(inpt))