Ejemplo n.º 1
0
 def calculate_payoff_times(self):
     """Calculates payoff time data and stores the results in the database"""
     with self.database.transaction():
         current_id = 0
         for Bo in constants.initial_balance_range():
             for r in constants.interest_rate_range():
                 for p in constants.monthly_payment_range():
                     print("Calculating for initial balance {0}, rate {1}, monthly payment {2}".format(Bo, r, p))
                     t = time_until_zero_balance(r, Bo, p)
                     if t is not None:
                         database.create_point(current_id, Bo, r, p, t)
                     current_id += 1
Ejemplo n.º 2
0
def test_set_mode():
    constants.set_mode('test')
    assert_not_in(1000, constants.initial_balance_range())

    constants.set_mode('actual')
    assert_in(1000, constants.initial_balance_range())