Beispiel #1
0
	def test_ReplaceStringWithZeroLength(self):
		myString = substr_replace('abcdefgh', 'bill', 2, 0)

		self.assertEqual(myString, 'abbillcdefgh')
Beispiel #2
0
	def test_ReplaceStringWithNegativeLength(self):
		myString = substr_replace('abcdefgh', 'bill', 2, -2)

		self.assertEqual(myString, 'abbillgh')
Beispiel #3
0
	def test_ReplaceStringWithPositiveLength(self):
		myString = substr_replace('abcdefgh', 'bill', 0, 4)

		self.assertEqual(myString, 'billefgh')
Beispiel #4
0
	def test_ReplaceStringWithNoneString(self):
		myString = substr_replace('abcdefgh', None, 0)

		self.assertEqual(myString, 'abcdefgh')
Beispiel #5
0
	def test_ReplaceNoneString(self):
		myString = substr_replace(None, 'bill', 0)

		self.assertEqual(myString, 'bill')
Beispiel #6
0
	def test_ReplaceStringWithNegativeStartIndex(self):
		myString = substr_replace('abcdefgh', 'bill', -1)

		self.assertEqual(myString, 'abcdefgbill')
Beispiel #7
0
	def test_ReplaceStringZeroStartIndex(self):
		myString = substr_replace('abcdefgh', 'bill', 0)

		self.assertEqual(myString, 'bill')