示例#1
0
 def setUp(self):
     self.student = Students.Students('Lehmann', 'Ben', 'Math', gpa=3.0)
示例#2
0
 def test_object_not_created_error_gpa(self):
     with self.assertRaises(ValueError):
         s = Students.Students('Lehmann', 'Ben', 'Math', 3.8)
示例#3
0
 def test_object_not_created_error_first_name(self):
     with self.assertRaises(ValueError):
         s = Students.Students('123', 'Lehmann', 'Math', 3.0)
示例#4
0
 def test_object_not_created_error_major(self):
     with self.assertRaises(ValueError):
         s = Students.Students('Lehmann', 'Ben', '123', 3.0)
示例#5
0
 def test_object_created_all_attributes(self):
     student = Students.Students('Lehmann', 'Ben', 'Math', gpa=3.0)
     assert student.last_name == 'Lehmann'
     assert student.first_name == 'Ben'
     assert student.major == 'Math'
     assert student.gpa == 3.0