示例#1
0
 def test_combined_payoff(self):
     """Payoff debts, with snowball"""
     results = ds.calculate_combined_payoff_tables([{
         'apr': '12',
         'balance': '10000',
         'payments': 41,
         'debt_name': 'debt b',
         'payment': '300'
     }, {
         'apr': '12',
         'balance': '10000',
         'payments': 70,
         'debt_name': 'debt a',
         'payment': '200'
     }, {
         'apr': '12',
         'balance': '10000',
         'payments': 111,
         'debt_name': 'debt c',
         'payment': '150'
     }])
     self.assertEqual('debt b', results[0]['debt_name'])
     self.assertEqual('debt a', results[1]['debt_name'])
     self.assertEqual('debt c', results[2]['debt_name'])
     self.assertEqual(ds.money_fmt(222.73),
                      results[0]['payoff_chart'][-1]['start_balance'])
     self.assertEqual(ds.money_fmt(250.55),
                      results[1]['payoff_chart'][-1]['start_balance'])
     self.assertEqual(ds.money_fmt(502.83),
                      results[2]['payoff_chart'][-1]['start_balance'])
示例#2
0
 def test_multi_loan(self):
     """Test running with one loan and additional paydown"""
     today = datetime.date.today()
     additional_start = today + relativedelta(years=5)
     result = ds.do_amortization('dummy', 95113.31, 1111.67, 5.375,
                                 additional_start, 1000)
     self.assertEqual(result[-1]['start_balance'], ds.money_fmt(1205.32))
示例#3
0
 def test_single_loan(self):
     """Test running with one loan"""
     result = ds.do_amortization('dummy', 95113.31, 1111.67, 5.375)
     self.assertEqual(len(result), 109)
     self.assertEqual(ds.money_fmt(147.32), result[-1]['start_balance'])
示例#4
0
 def test_blank(self):
     """Test an empty number, again, for full coverage"""
     self.assertEqual(ds.money_fmt(0), '$0.00')
示例#5
0
 def test_negative_sign(self):
     """A test case so we get full covergage :)"""
     self.assertEqual(ds.money_fmt(-10), '-$10.00')