-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_python_hw4.py
35 lines (32 loc) · 1.14 KB
/
test_python_hw4.py
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
33
34
35
import unittest
import python_hw4
class Test_python_hw4(unittest.TestCase):
def test_cube(self):
result = python_hw4.cube(2)
self.assertEqual(result, 8)
def test_cube(self):
result = python_hw4.cube(-5)
self.assertEqual(result, -125)
def test_cube(self):
result = python_hw4.cube("nice")
self.assertTrue(result)
def test_avg(self):
result = python_hw4.avg([4, 6])
self.assertEqual(result, 5)
def test_avg(self):
result = python_hw4.avg([])
self.assertException(Exception)
def test_avg(self):
result = python_hw4.avg([5, 5, 5])
self.assertEqual(result, 5)
def test_combine(self):
result = python_hw4.combine("Emmet", "Miller")
self.assertEqual(result, "Emmet Miller")
def test_combine(self):
result = python_hw4.combine("Lily", "Naganuma")
self.assertEqual(result, "Lily Naganuma")
def test_combine(self):
result = python_hw4.combine("Ronald", "McDonald")
self.assertEqual(result, "Ronald McDonald")
if __name__ == '__main__':
unittest.main()