Example #1
0
 def testGetSubArrayFrom1To3(self):
     test_input = ["The", "Quick", "Brown", "Fox", "Jumps"]
     expected = ["Quick", "Brown"]
     start_index = 1
     end_index = 3
     actual = StringArrayUtils.get_sub_array(test_input, start_index,
                                             end_index)
     self.assertEqual(expected, actual)
Example #2
0
 def testGetSubArrayOutOfBounds2(self):
     test_input = ["The", "Quick", "Brown", "Fox", "Jumps"]
     start_index = -1
     end_index = -10
     with self.assertRaises(IndexError):
         StringArrayUtils.get_sub_array(test_input, start_index, end_index)
Example #3
0
 def testGetEndingArrayOutOfBounds1(self):
     test_input = ["The", "Quick", "Brown", "Fox", "Jumps"]
     start_index = 98
     with self.assertRaises(IndexError):
         StringArrayUtils.get_ending_array(test_input, start_index)
Example #4
0
 def testGetEndingArrayFrom1(self):
     test_input = ["The", "Quick", "Brown", "Fox", "Jumps"]
     expected = ["Quick", "Brown", "Fox", "Jumps"]
     start_index = 1
     actual = StringArrayUtils.get_ending_array(test_input, start_index)
     self.assertEqual(expected, actual)