def test_SubstrWWithZeroLength(self): subString = substr("abcdef", 3, 0) self.assertFalse(subString)
def test_SubstrWithNegativeLength(self): subString = substr("abcdef", 2, -1) self.assertEqual(subString, 'cde')
def test_SubstrWithANumberTooNegative(self): subString = substr("abcdef", 4, -4) self.assertFalse(subString)
def test_SubstrWithNULLInput(self): subString = substr(None, -1) self.assertFalse(subString)
def test_SubstrWithPositiveLength(self): subString = substr("abcdef", 3, 1) self.assertEqual(subString, 'd')
def test_SubstrWithNegativeStartIndex(self): subString = substr("hello", -1) self.assertEqual(subString, "o")
def test_SubstrLenthLessThanNegativeStartIndex(self): subString = substr("one", -4) self.assertFalse(subString)
def test_SubstrWithPositiveStartIndex(self): subString = substr("hello", 2) self.assertEqual(subString, "llo")