コード例 #1
0
 def test_object_not_created_error_gpa(self):
     with self.assertRaises(ValueError):
         student = s.Student("Wang", "Shiqi", "Computer Science", 3)
     with self.assertRaises(ValueError):
         student = s.Student("Wang", "Shiqi", "Computer Science", "abc")
     with self.assertRaises(ValueError):
         student = s.Student("Wang", "Shiqi", "Computer Science", 5.0)
コード例 #2
0
ファイル: test_student.py プロジェクト: JohnDRyanIV/Module10
 def test_object_not_created_error_gpa(self):
     with self.assertRaises(TypeError):
         student = s.Student("Dorna", "Jim", "Comp Sci", "3.50")
     with self.assertRaises(ValueError):
         student = s.Student("Dorna", "Jim", "Comp Sci", 4.01)
         student = s.Student("Dorna", "Jim", "Comp Sci", 400)
         student = s.Student("Dorna", "Jim", "Comp Sci", -.01)
コード例 #3
0
ファイル: test_student.py プロジェクト: JohnDRyanIV/Module10
 def test_object_not_created_error_last_name(self):
     with self.assertRaises(TypeError):
         student = s.Student("Jim", "Comp Sci")
         student = s.Student("Jim", "Comp Sci", 3.50)
     with self.assertRaises(ValueError):
         student = s.Student("Jim", "Comp Sci", "3.50")
         student = s.Student("3.50", "Jim", "Comp Sci")
         student = s.Student(3.50, "Jim", "Comp Sci")
コード例 #4
0
 def test_student_class_display_name_ssn(self):
     p = t.Student('Manning', 'Peyton', 'computer information science',
                   2.5)  # Does not use person from setUp(), has local p
     self.assertEqual(
         str(p),
         "Manning, Peyton has major computer information science with gpa: 2.5"
     )
コード例 #5
0
 def test_object_created_all_attributes(self):
     student = t.Student(
         'Duck', 'Daisy',
         '111-11-1111')  # this is not self.person from setUp, but local
     assert student.last_name == 'Duck'  # note no self here on person or assert
     assert student.first_name == 'Daisy'
     assert student.major == 'Math'
コード例 #6
0
 def test_inital_all_attributes(self):
     student = t.Student(
         'Manning', 'Peyton', 'computer information science',
         2.5)  # this is not self.person from setUp, but local
     assert student.last_name == 'Manning'  # note no self here on person or assert
     assert student.first_name == 'Peyton'
     assert student.major == 'computer information science'
     assert student.gpa == 2.5
コード例 #7
0
 def test_object_created_all_attributes(self):
     student = s.Student(
         'Smith', 'Johnny', 'Culinary',
         3.25)  # this is not self.person from setUp, but local
     assert student.last_name == 'Smith'  # note no self here on person or assert
     assert student.first_name == 'Johnny'
     assert student.major == 'Culinary'
     assert student.gpa == 3.25
コード例 #8
0
 def test_object_created_all_attributes(self):
     student = s.Student(
         'Meeker', 'Daniel', 'BIS-OOP',
         3.9)  # this is not self.person from setUp, but local
     assert student.last_name == 'Meeker'  # note no self here on person or assert
     assert student.first_name == 'Daniel'
     assert student.major == 'BIS-OOP'
     assert student.gpa == 3.9
コード例 #9
0
ファイル: test_student.py プロジェクト: rachelli12/Module10
 def test_object_created_all_attributes(self):
     #test constructor values set to all attributes for acceptable values
     student = s.Student(
         'Chan', 'Jackie', 'Biology',
         3.9)  #this is not self.student from setUp, but local
     assert student.last_name == 'Chan'  #no self
     assert student.first_name == 'Jackie'
     assert student.major == 'Biology'
     assert student.gpa == 3.9
コード例 #10
0
 def setUp(self):
     self.student = s.Student('Janeway', 'Kathryn', 'CIS', 4.0)
コード例 #11
0
ファイル: test_student.py プロジェクト: JohnDRyanIV/Module10
 def setUp(self):
     self.student = s.Student("Dorna", "Jim", "Comp Sci")
コード例 #12
0
ファイル: test_student.py プロジェクト: JohnDRyanIV/Module10
 def test_object_not_created_error_major(self):
     with self.assertRaises(TypeError):
         student = s.Student("Dorna", "Jim")
         student = s.Student("Dorna", "Jim", 3.50)
     with self.assertRaises(ValueError):
         student = s.Student("Dorna", "Jim", "3.50")
コード例 #13
0
ファイル: test_student.py プロジェクト: JohnDRyanIV/Module10
 def test_student_str(self):
     student = s.Student("Dorna", "Jim", "Comp Sci", 3.50)
     assert str(student) == "Dorna, Jim has major Comp Sci with gpa: 3.5"
コード例 #14
0
 def test_object_not_created_error_in_gpa(self):
     with self.assertRaises(ValueError):
         p = s.Student('Janeway', 'Kathryn', 'CIS', 5.0)
         d = s.Student('Janeway', 'Kathryn', 'CIS', 2)
         q = s.Student('Janeway', 'Kathryn', 'CIS', 'Four Point O')
コード例 #15
0
ファイル: test_student.py プロジェクト: JohnDRyanIV/Module10
 def test_object_created_all_attributes(self):
     student = s.Student("Dorna", "Jim", "Comp Sci", 3.50)
     assert student.last_name == "Dorna"
     assert student.first_name == "Jim"
     assert student.major == "Comp Sci"
     assert student.gpa == 3.50
コード例 #16
0
 def test_object_not_created_error_last_name(self):
     with self.assertRaises(ValueError):
         l_student = s.Student('123', 'Michael', 'CIS')
コード例 #17
0
 def test_object_not_created_error_in_major(self):
     with self.assertRaises(ValueError):
         p = s.Student('Janeway', 'Kathryn', 'Reading')
コード例 #18
0
 def test_object_not_created_error_first_name(self):
     with self.assertRaises(ValueError):
         s = t.Student('Sears', '809', 'CIS')
コード例 #19
0
 def test_object_not_created_error_gpa(self):
     with self.assertRaises(ValueError):
         s = t.Student('Sears', 'Ricky', 'CIS', 'threepointfourfive')
コード例 #20
0
 def test_object_created_all_attributes(self):
     student = t.Student("Sears", "Ricky", "CIS", 3.48)
     assert student.last_name == "Sears"
     assert student.first_name == "Ricky"
     assert student.major == "CIS"
     assert student.gpa == 3.48
コード例 #21
0
 def setUp(self):
     self.t_student = s.Student('Day', 'Michael', 'CIS')
コード例 #22
0
 def test_object_not_created_error_gpa(self):
     with self.assertRaises(ValueError):
         l_student = s.Student('Day', 'Michael', 'CIS', 'cat')
     with self.assertRaises(ValueError):
         l_student = s.Student('Day', 'Michael', 'CIS', 999)
コード例 #23
0
 def test_object_not_created_error_major(self):
     with self.assertRaises(ValueError):
         l_student = s.Student('Day', 'Michael', '123')
コード例 #24
0
 def test_object_not_created_error_first_name(self):
     with self.assertRaises(ValueError):
         l_student = s.Student('Day', '123', 'CIS')
コード例 #25
0
 def test_object_not_created_error_last_name(self):
     with self.assertRaises(ValueError):
         s = t.Student('5', 'Ricky', 'CIS')
コード例 #26
0
 def test_object_created_all_attributes(self):
     student = s.Student('Janeway', 'Kathryn', 'CIS', 4.0)
     assert student.last_name == 'Janeway'
     assert student.first_name == 'Kathryn'
     assert student.major == 'CIS'
     assert student.gpa == 4.0
コード例 #27
0
 def test_object_not_created_error_major(self):
     with self.assertRaises(ValueError):
         s = t.Student('Sears', 'Ricky', '515')
コード例 #28
0
 def test_object_not_created_error_last_name(self):
     with self.assertRaises(ValueError):
         p = s.Student('333', 'Kathryn', 'CIS')
コード例 #29
0
 def setUp(self):
     self.student = t.Student('Sears', 'Ricky', 'CIS', 3.48)
コード例 #30
0
 def test_object_not_created_error_fist_name(self):
     with self.assertRaises(ValueError):
         p = s.Student('Janeway', '333', 'CIS')