def test_invalid(self):
     s1 = Student('Bart', -1)
     s2 = Student('Lisa', 101)
     with self.assertRaises(ValueError):
         s1.get_grade()
     with self.assertRaises(ValueError):
         s2.get_grade()
Beispiel #2
0
def main():

    student = Student()
    #print(student)
    student.name = "Geoff"
    student.ID = 123456
    student.grade = "D"
    #print(student)
    new_student_grade = "HD"
    #print("TEST ",new_student_grade)
    student.changeGrade(new_student_grade)
    new_student_ID = 111111
    student.changeID(new_student_ID)
    print(student)
 def test_80_to_100(self):
     s1 = Student('Bart', 80)
     s2 = Student('Lisa', 100)
     self.assertEqual(s1.get_grade(), 'A')
     self.assertEqual(s2.get_grade(), 'A')
 def test_0_to_60(self):
     s1 = Student('Bart', 0)
     s2 = Student('Lisa', 59)
     self.assertEqual(s1.get_grade(), 'C')
     self.assertEqual(s2.get_grade(), 'C')
 def test_60_to_80(self):
     s1 = Student('Bart', 60)
     s2 = Student('Lisa', 79)
     self.assertEqual(s1.get_grade(), 'B')
     self.assertEqual(s2.get_grade(), 'B')