def test_index_of_student_student_present(self): test_class = ClassList(3) test_class.add_student('Harry') test_class.add_student('Hermione') test_class.add_student('Ron') self.assertEqual(1, test_class.index_of_student('Harry')) self.assertEqual(2, test_class.index_of_student('Hermione')) self.assertEqual(3, test_class.index_of_student('Ron')) # This assert passes, but it's redundant - the first assert statement will fail if # the method call returns None self.assertIsNotNone(test_class.index_of_student('Harry'))
def test_search_results_in_none_for_student_not_in_class(self): test_class = ClassList(2) test_class.add_student('Kirk Cousins') test_class.add_student('Deshaun Watson') index = test_class.index_of_student('Tom Brady') self.assertIsNone(index)
def test_index_of_students_is_none_if_classlist_is_empty(self): test_class = ClassList(2) index = test_class.index_of_student('Test Student') self.assertIsNone(index)