-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_1104.py
More file actions
32 lines (31 loc) · 949 Bytes
/
Copy pathtest_1104.py
File metadata and controls
32 lines (31 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import unittest
import class_test
class TestStudent(unittest.TestCase):
"""docstring for TestStudent"""
# def __init__(self, arg):
# super(TestStudent, self).__init__()
# self.arg = arg
def test_invalid(self):
s1=class_test.Student(1,56)
s2=class_test.Student('nio',102)
with self.assertRaises(ValueError):
s1.get_name()
with self.assertRaises(ValueError):
s2.get_grade()
def test_80_100(self):
s1=class_test.Student('lee',81)
s2=class_test.Student('jsion',100)
self.assertEqual(s1.get_grade(),'A')
self.assertEqual(s2.get_grade(),'A')
def test_60_80(self):
s1=class_test.Student('lee',60)
s2=class_test.Student('jsion',79)
self.assertEqual(s1.get_grade(),'B')
self.assertEqual(s2.get_grade(),'B')
def test_0_60(self):
s1=class_test.Student('lee',1)
s2=class_test.Student('jsion',59)
self.assertEqual(s1.get_grade(),'C')
self.assertEqual(s2.get_grade(),'C')
if __name__=='__main__':
unittest.main()