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

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

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

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

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

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

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

		self.assertEqual(myString, 'bill')