/
tests_unit.py
134 lines (109 loc) · 5.22 KB
/
tests_unit.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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
"""
Unittests to check that the results are calculating correctly
based on various user input.
Two main functions are generating the results/priority goals
and associated semi-circle graphs:
utils.calc_financial_results - calculating the "Amount Funded"
utils.calc_max_financials - calculating the "Target Remaining"
"""
import unittest
import utils
class UserResultsTestCase(unittest.TestCase):
def test_user_results_one(self):
self.assertEqual(utils.calc_financial_results(
0, 0, "No", "No", 0, 0), {
"checking": 0, "savings": 0, "match": 0,
"ira": 0, "ret401k": 0, "investment": 0})
def test_user_results_two(self):
self.assertEqual(utils.calc_financial_results(
0, 0, "Yes", "Yes", 0, 0), {
"checking": 0, "savings": 0, "match": 0,
"ira": 0, "ret401k": 0, "investment": 0})
def test_user_results_three(self):
self.assertEqual(utils.calc_financial_results(
10000, 60000, "No", "No", 0, 0), {
"checking": 3700, "savings": 6300, "match": 0,
"ira": 0, "ret401k": 0, "investment": 0})
def test_user_results_four(self):
self.assertEqual(utils.calc_financial_results(
20000, 60000, "No", "No", 0, 0), {
"checking": 3700, "savings": 11100, "match": 0,
"ira": 5200, "ret401k": 0, "investment": 0})
def test_user_results_five(self):
self.assertEqual(utils.calc_financial_results(
30000, 60000, "No", "No", 0, 0), {
"checking": 3700, "savings": 11100, "match": 0,
"ira": 5500, "ret401k": 0, "investment": 9700})
def test_user_results_six(self):
self.assertEqual(utils.calc_financial_results(
10000, 60000, "Yes", "Yes", 1.0, 0.05), {
"checking": 3700, "savings": 6300, "match": 0,
"ira": 0, "ret401k": 0, "investment": 0})
def test_user_results_seven(self):
self.assertEqual(utils.calc_financial_results(
20000, 60000, "Yes", "Yes", 1.0, 0.05), {
"checking": 3700, "savings": 11100, "match": 3000,
"ira": 2200, "ret401k": 0, "investment": 0})
def test_user_results_eight(self):
self.assertEqual(utils.calc_financial_results(
30000, 60000, "Yes", "Yes", 1.0, 0.05), {
"checking": 3700, "savings": 11100, "match": 3000,
"ira": 5500, "ret401k": 6700, "investment": 0})
def test_user_results_eight(self):
self.assertEqual(utils.calc_financial_results(
40000, 60000, "Yes", "Yes", 1.0, 0.05), {
"checking": 3700, "savings": 11100, "match": 3000,
"ira": 5500, "ret401k": 15000, "investment": 1700})
def test_user_results_nine(self):
self.assertEqual(utils.calc_financial_results(
10000, 60000, "Yes", "No", 0, 0), {
"checking": 3700, "savings": 6300, "match": 0,
"ira": 0, "ret401k": 0, "investment": 0})
def test_user_results_ten(self):
self.assertEqual(utils.calc_financial_results(
20000, 60000, "Yes", "No", 0, 0), {
"checking": 3700, "savings": 11100, "match": 0,
"ira": 5200, "ret401k": 0, "investment": 0})
def test_user_results_eleven(self):
self.assertEqual(utils.calc_financial_results(
30000, 60000, "Yes", "No", 0, 0), {
"checking": 3700, "savings": 11100, "match": 0,
"ira": 5500, "ret401k": 9700, "investment": 0})
def test_user_results_twelve(self):
self.assertEqual(utils.calc_financial_results(
40000, 60000, "Yes", "No", 0, 0), {
"checking": 3700, "savings": 11100, "match": 0,
"ira": 5500, "ret401k": 18000, "investment": 1700})
class MaxResultsTestCase(unittest.TestCase):
def test_max_results_one(self):
self.assertEqual(utils.calc_max_financials(
0, "No", "No", 0, 0), {
"checking": 0, "savings": 0, "match": 0,
"ira": 5500, "ret401k": 0, "investment": 0})
def test_max_results_two(self):
self.assertEqual(utils.calc_max_financials(
0, "Yes", "Yes", 0, 0), {
"checking": 0, "savings": 0, "match": 0,
"ira": 5500, "ret401k": 18000, "investment": 0})
def test_max_results_three(self):
self.assertEqual(utils.calc_max_financials(
0, "Yes", "No", 0, 0), {
"checking": 0, "savings": 0, "match": 0,
"ira": 5500, "ret401k": 18000, "investment": 0})
def test_max_results_four(self):
self.assertEqual(utils.calc_max_financials(
60000, "No", "No", 0, 0), {
"checking": 3700, "savings": 11100, "match": 0,
"ira": 5500, "ret401k": 0, "investment": 0})
def test_max_results_five(self):
self.assertEqual(utils.calc_max_financials(
60000, "Yes", "No", 0, 0), {
"checking": 3700, "savings": 11100, "match": 0,
"ira": 5500, "ret401k": 18000, "investment": 0})
def test_max_results_six(self):
self.assertEqual(utils.calc_max_financials(
60000, "Yes", "Yes", 1.0, 0.05), {
"checking": 3700, "savings": 11100, "match": 3000,
"ira": 5500, "ret401k": 15000, "investment": 0})
if __name__ == "__main__":
unittest.main()