def test_up_to_first_string(self): my_str = "CSCA08" up_to = 'A' expected = "CSC" actual = ex4.up_to_first(my_str, up_to) self.assertEqual(expected, actual, "Testing up_to_first() with strings.")
def test_up_to_first(self): my_list = [1, 2, 3, 4] up_to = 3 expected = [1, 2] actual = ex4.up_to_first(my_list, up_to) self.assertEqual(expected, actual, "Testing up_to_first() with example from handout.")
def test_up_to_first_multiple_occurrences(self): my_list = [5, 6, 3, 8, 3, 7] up_to = 3 expected = [5, 6] actual = ex4.up_to_first(my_list, up_to) self.assertEqual( expected, actual, "Testing up_to_first() with multiple occurrences of the object.")
def test_up_to_first_object_not_in_list(self): my_list = [5, 2, 8, 3] up_to = 7 expected = [5, 2, 8, 3] actual = ex4.up_to_first(my_list, up_to) self.assertEqual( expected, actual, "Testing up_to_first() with the object not in the list.")
def test_up_to_first_object_at_beginning(self): my_list = [5, 2, 8, 3] up_to = 5 expected = [] actual = ex4.up_to_first(my_list, up_to) self.assertEqual( expected, actual, "Testing up_to_first() with the object at the beginning of the list." )