Exemple #1
0
    def test_SubstrWWithZeroLength(self):
        subString = substr("abcdef", 3, 0)

        self.assertFalse(subString)
Exemple #2
0
    def test_SubstrWithNegativeLength(self):
        subString = substr("abcdef", 2, -1)

        self.assertEqual(subString, 'cde')
Exemple #3
0
    def test_SubstrWithANumberTooNegative(self):
        subString = substr("abcdef", 4, -4)

        self.assertFalse(subString)
Exemple #4
0
    def test_SubstrWithNULLInput(self):
        subString = substr(None, -1)

        self.assertFalse(subString)
Exemple #5
0
    def test_SubstrWithPositiveLength(self):
        subString = substr("abcdef", 3, 1)

        self.assertEqual(subString, 'd')
Exemple #6
0
    def test_SubstrWithNegativeStartIndex(self):
        subString = substr("hello", -1)

        self.assertEqual(subString, "o")
Exemple #7
0
    def test_SubstrLenthLessThanNegativeStartIndex(self):
        subString = substr("one", -4)

        self.assertFalse(subString)
Exemple #8
0
	def test_SubstrWWithZeroLength(self):
		subString = substr("abcdef", 3, 0)

		self.assertFalse(subString)
Exemple #9
0
    def test_SubstrWithPositiveStartIndex(self):
        subString = substr("hello", 2)

        self.assertEqual(subString, "llo")
Exemple #10
0
	def test_SubstrWithNegativeLength(self):
		subString = substr("abcdef", 2, -1)

		self.assertEqual(subString, 'cde')
Exemple #11
0
	def test_SubstrWithANumberTooNegative(self):
		subString = substr("abcdef", 4, -4)

		self.assertFalse(subString)
Exemple #12
0
	def test_SubstrWithPositiveLength(self):
		subString = substr("abcdef", 3, 1)

		self.assertEqual(subString, 'd')
Exemple #13
0
	def test_SubstrWithNULLInput(self):
		subString = substr(None, -1)

		self.assertFalse(subString)
Exemple #14
0
	def test_SubstrLenthLessThanNegativeStartIndex(self):
		subString = substr("one", -4)

		self.assertFalse(subString)
Exemple #15
0
	def test_SubstrWithNegativeStartIndex(self):
		subString = substr("hello", -1)

		self.assertEqual(subString, "o")
Exemple #16
0
	def test_SubstrWithPositiveStartIndex(self):
		subString = substr("hello", 2)

		self.assertEqual(subString, "llo")