def test_cut_list_string(self): my_str = "CSCA08" cut_at = 2 expected = "A08CCS" actual = ex4.cut_list(my_str, cut_at) self.assertEqual(expected, actual, "Testing cut_list() with strings.")
def test_cut_list_at_beginning(self): my_list = [5, 2, 8, 3] cut_at = 0 expected = [2, 8, 3, 5] actual = ex4.cut_list(my_list, cut_at) self.assertEqual(expected, actual, "Testing cut_list() with cut index = 0.")
def test_cut_list_1(self): my_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] cut_at = 3 expected = [4, 5, 6, 7, 8, 9, 3, 0, 1, 2] actual = ex4.cut_list(my_list, cut_at) self.assertEqual(expected, actual, "Testing cut_list() with example from handout.")
def test_cut_list_at_end(self): my_list = [5, 2, 8, 3] cut_at = len(my_list) - 1 expected = [3, 5, 2, 8] actual = ex4.cut_list(my_list, cut_at) self.assertEqual( expected, actual, "Testing cut_list() with cut index = len(my_list) - 1.")
def test_cut_list_2(self): my_list = [4, 5, 6, 7, 8, 9, 10, 3, 0, 1, 2] cut_at = 7 expected = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] actual = ex4.cut_list(my_list, cut_at) self.assertEqual( expected, actual, "Testing cut_list() with an index other than the one in the handout." )