def test_add_and_remove_student_check_student_is_removed(self): test_class = ClassList(2) student = "Kitty Cat" test_class.add_student(student) test_class.remove_student(student) self.assertNotIn(student, test_class.class_list)
def test_index_of_student_in_empty_list_return_None(self): test_class = ClassList(1) self.assertIsNone(test_class.index_of_student('Hamze'))
def test_is_class_full(self): test_class = ClassList(4) test_class.add_student('Farmaajo') test_class.add_student('Mukami') test_class.add_student('Abdi') test_class.add_student('Bisharo') self.assertTrue(test_class.is_class_full())
def test_add_students_to_list_check_whether_enrolled(self): test_class = ClassList(2) test_class.add_student('Anne Bolean') self.assertTrue(test_class.is_enrolled('Anne Bolean')) self.assertFalse(test_class.is_enrolled('Bloody Mary'))
def test_string_empty_class(self): test_class = ClassList(2) self.assertEqual('', test_class.__str__())
def test_remove_student_not_in_list(self): test_class = ClassList(2) with self.assertRaises(StudentError): test_class.remove_student('Not in Student Classlist')
def test_enrollment_when_student_present(self): test_class = ClassList(2) test_class.add_student('Snoop Dogg') test_class.add_student('Martha Stewart') self.assertTrue(test_class.is_enrolled('Snoop Dogg')) self.assertTrue(test_class.is_enrolled('Martha Stewart'))
def test_student_not_enrolled(self): test_class = ClassList(2) test_class.add_student('Test Student') self.assertFalse(test_class.is_enrolled('Jimmy'))
def test_index_of_students_for_empty_list(self): test_class = ClassList(3) self.assertIsNone(test_class.index_of_student('Gerald Green'))
def test_class_not_full(self): test_class = ClassList(3) test_class.add_student('Harry') test_class.add_student('Hermione') self.assertFalse(test_class.is_class_full())
def test_remove_student_not_in_list(self): test_class = ClassList(2) test_class.add_student('Test Student') with self.assertRaises(StudentError): test_class.remove_student('Jimmy')
def test_student_not_in_list_empty_list(self): test_class = ClassList(3) self.assertIsNone(test_class.index_of_student('Jimmy'))
def test_INDEX_OF_STUDENT_returns_None_when_student_not_in_empty_list( self): test_class = ClassList(2) student = "Kitty Cat" self.assertIsNone(test_class.index_of_student(student))
def test_remove_student_from_empty_list_check_studentError(self): test_class = ClassList(2) student = "Kitty Cat" with self.assertRaises(StudentError): test_class.remove_student(student)
def test_add_student_already_in_list(self): test_class = ClassList(2) test_class.add_student('Test Student') with self.assertRaises(StudentError): test_class.add_student('Test Student')
def test_index_with_nonexistent_student(self): test_class = ClassList(3) test_class.add_student('Ray Allen') self.assertIsNone(test_class.index_of_student('Bill Russel'))
def test_add_then_remove_student(self): test_class = ClassList(2) test_class.add_student('And Another Test Student') test_class.remove_student('And Another Test Student') self.assertNotIn('And Another Test Student', test_class.class_list)
def test_if_class_is_full_when_it_is(self): test_class = ClassList(2) test_class.add_student('Ray Allen') test_class.add_student('Derrick Rose') self.assertTrue(test_class.is_class_full())
def test_remove_student_from_empty_list(self): test_class = ClassList(2) with self.assertRaises(StudentError): test_class.remove_student('Nobody')
def test_if_class_is_full_when_empty(self): test_class = ClassList(3) self.assertFalse(test_class.is_class_full())
def test_enrollment_empty_list(self): test_class = ClassList(2) self.assertFalse(test_class.is_enrolled('Snoop Dogg'))
def test_add_remove_from_list(self): test_class = ClassList(2) test_class.add_student('Test Student') self.assertIn('Test Student', test_class.class_list) test_class.remove_student('Test Student') self.assertNotIn('Test Student', test_class.class_list)
def test_string_with_students_enrolled(self): test_class = ClassList(2) test_class.add_student('Taylor Swift') test_class.add_student('Kanye West') self.assertEqual('Taylor Swift, Kanye West', test_class.__str__())
def test_removes_student_from_empty_list_and_errors(self): test_class = ClassList(1) with self.assertRaises(StudentError): test_class.remove_student('Nonexistent Student')
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_isenrolled_for_student_not_enrolled(self): test_class = ClassList(4) test_class.add_student('Harry Potter') test_class.add_student('Lebron James') self.assertFalse(test_class.is_enrolled('Chris Bosh'))
def test_index_of_student_list_not_empty_search_student_not_in_list(self): test_class = ClassList(2) test_class.add_student('Mohamud') test_class.add_student('Muhumed') self.assertIsNone(test_class.index_of_student('Mary'))
def test_string_empty_class(self): test_class = ClassList(2) self.assertEqual('', str(test_class))
def test_is_class_full_empty(self): test_class = ClassList(2) self.assertFalse(test_class.is_class_full())
def test_enrollment_when_student_not_present(self): test_class = ClassList(2) test_class.add_student('Mary') test_class.add_student('John') self.assertFalse(test_class.is_enrolled('Kohl'))