Ejemplo n.º 1
0
 def test_set_goal(self):
     person = Retirement_Savings(22, 70000, .2, 500000)
     with self.assertRaises(KeyError):
         person.set_goal(-1)
     with self.assertRaises(KeyError):
         person.set_goal(0)
     with self.assertRaises(KeyError):
         person.set_goal(1000000001)
     self.assertEqual(person.set_goal(1000000000), 1000000000)
     self.assertEqual(person.set_goal(1000000), 1000000)
Ejemplo n.º 2
0
 def test_set_percent(self):
     person = Retirement_Savings(22, 70000, .2, 500000)
     with self.assertRaises(KeyError):
         person.set_percent(-1)
     with self.assertRaises(KeyError):
         person.set_percent(0)
     with self.assertRaises(KeyError):
         person.set_percent(1.1)
     self.assertEqual(person.set_percent(1), 1)
     self.assertEqual(person.set_percent(.2), .2)
Ejemplo n.º 3
0
 def test_set_salary(self):
     person = Retirement_Savings(22, 70000, .2, 500000)
     with self.assertRaises(KeyError):
         person.set_salary(-1)
     with self.assertRaises(KeyError):
         person.set_salary(0)
     with self.assertRaises(KeyError):
         person.set_salary(500001)
     self.assertEqual(person.set_salary(500000), 500000)
     self.assertEqual(person.set_salary(70000), 70000)
Ejemplo n.º 4
0
 def test_create_Retirment(self):
     person = Retirement_Savings(22, 70000, .2, 500000)
Ejemplo n.º 5
0
 def test_age_goal_met(self):
     person = Retirement_Savings(22, 70000, .2, 1000000)
     self.assertEqual(person.age_goal_met(), 75)
Ejemplo n.º 6
0
 def test_savings_per_year(self):
     person = Retirement_Savings(22, 70000, .2, 500000)
     self.assertEqual(person.savings_per_year(70000, .2), 18900)