def test_get_non_existent_student(self): """ 050C - Invalid Get Student Non-Existent """ test_student_1 = Student("Bill", "Smith", "A0100000000", "CIT") test_student_1.add_course("ACIT2515") test_student_2 = Student("Ken", "Rodgers", "A0100000001", "CIT") test_student_2.add_course("ACIT2515") test_student_2.add_course("COMP1409") test_school = School("Computing and Academic Studies") test_school.add_student(test_student_1) test_school.add_student(test_student_2) self.assertIsNone(test_school.get_student("AXXXYYYZZZ"), "No student should exists for AXXXYYYZZZ")
def test_get_student(self): """ 050A - Valid Get Student """ test_student_1 = Student("Bill", "Smith", "A0100000000", "CIT") test_student_1.add_course("ACIT2515") test_student_2 = Student("Ken", "Rodgers", "A0100000001", "CIT") test_student_2.add_course("ACIT2515") test_student_2.add_course("COMP1409") test_school = School("Computing and Academic Studies") test_school.add_student(test_student_1) test_school.add_student(test_student_2) retrieved_student = test_school.get_student("A0100000001") self.assertEqual(retrieved_student.get_student_number(), "A0100000001", "Student must have student number A0100000001") self.assertEqual(retrieved_student.get_program(), "CIT", "Student must be in CIT program")
sc = School() while(True): cmd = input("which do you want??\n** Press [ctrl+c] to quit\nadd_Student(ast)\tprint_All(p)\tadd_Score(asc)\tcheck_fail(cf)\nidiot(li)\tgenius(lg)") if cmd == "ast": name = input("name: ") sex = input("sex [M/F]: ") idnumber = input("idnumber: ") s = Student(name, sex, idnumber) while(True): score = int(input("Score: (-0 to quit)")) if score == -0: break else: s.add_score(score) sc.add_student(s) elif cmd == "p": sc.print() elif cmd == "asc": name = input("name: ") score = int(input("score: ")) s = sc.get_student(name) s.add_score(score) elif cmd == "cf": sc.list_fail() elif cmd == "lg": sc.list_genious() elif cmd == "li": sc.list_idiot()