コード例 #1
0
ファイル: test_school.py プロジェクト: lupomancer/Python
    def test_get_school_details(self):
        """ 050A - Valid Get Course """
        test_course_1 = Course("ACIT2515", "123456", "CIT")
        test_course_1.add_student("A010000056")

        test_course_2 = Course("COMP1510", "456321", "CST")
        test_course_2.add_student("A010000056")
        test_course_2.add_student("A010450012")

        test_school = School("BCIT")
        test_school.add_course(test_course_1)
        test_school.add_course(test_course_2)
        
        retreived_school = test_school.get_school_details()
        self.assertEqual(retreived_school["school_name"], "BCIT", "School must be named BCIT")
        self.assertEqual(retreived_school["num_courses"], 2, "School must have two programs")
        self.assertEqual(sorted(retreived_school["programs"]), sorted(["CIT", "CST"]), "School must have CST as the program")
コード例 #2
0
from student import Student
from school import School

exampleStudent1 = Student("Mike", "Biology", 3.5)
exampleStudent2 = Student("Jim", "Mathematics", 4.0)
exampleStudent3 = Student("Catherine", "Computer Science", 2.7)
exampleStudent4 = Student("Joseph", "Law", 2.2)
exampleStudent5 = Student("Angel", "Environmental Sciences", 3.2)

exampleSchool = School("Example University", "Somewhere, Wisconsin", [
    exampleStudent1, exampleStudent2, exampleStudent3, exampleStudent4,
    exampleStudent5
])

exampleSchool.get_school_details()
exampleSchool.get_all_student_descriptions()