-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_simple_test_functions_unittests.py
More file actions
74 lines (51 loc) · 2.02 KB
/
Copy pathtest_simple_test_functions_unittests.py
File metadata and controls
74 lines (51 loc) · 2.02 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
""" Tests for simple_test_functions.py """
import unittest
from simple_test_functions import *
class TestSimpleTestFunctions(unittest.TestCase):
""" Test class for simple_test_functions.py """
def setUp(self):
print('Setting up...........')
def tearDown(self):
print('..........Tearing down')
# test max_of_three_bad()
def test_max_of_three_bad_1(self):
self.assertEqual(max_of_three_bad(2, 3, 4), 4)
def test_max_of_three_bad_2(self):
self.assertEqual(max_of_three_bad(4, 3, 2), 4)
def test_max_of_three_bad_3(self):
self.assertEqual(max_of_three_bad(3, 2, 4), 4)
# test max_of_three_good()
def test_max_of_three_good_1(self):
self.assertEqual(max_of_three_good(2,3,4), 4)
def test_max_of_three_good_2(self):
self.assertEqual(max_of_three_good(4,3,2), 4)
def test_max_of_three_good_2(self):
self.assertEqual(max_of_three_good(3,2,4), 4)
# test maxmum()
def test_maximum_1(self):
self.assertEqual(maximum([2, 3, 4, 1]), 4)
def test_maximum_2(self):
self.assertEqual(maximum([4, 3, 2, 1]), 4)
def test_maximum_3(self):
self.assertEqual(maximum([-2, -3, 0, -21]), 0)
# test sum_up()
def test_sum_up_1(self):
self.assertEqual(sum_up([0, 3, 4]), 7)
def test_sum_up_2(self):
self.assertEqual(sum_up([-3, 0, 5]), 2)
# test ListManager - Some code that can throw an exception
def test_list_manager_1(self):
lstmgr = ListManager([1, 2, 3])
self.assertEqual(lstmgr.get(2), 3)
def test_list_manager_2(self):
lstmgr = ListManager([1, 2, 3])
self.assertEqual(lstmgr.get(3), 3)
def test_list_manager_3(self):
lstmgr = ListManager([1, 2, 3])
self.assertEqual(lstmgr.get(0), 1)
def test_list_manager_4(self):
lstmgr = ListManager([1, 2, 3])
self.assertEqual(lstmgr.get(0), 0)
if __name__ == '__main__':
unittest.main()