def test_equal_amounts_repayment_for_all_years(self):
        test_example = DebtExpenses(200000, 0.14, 4)
        req_sum = 0
        for i in range(1, 5, 1):
            _, expenses = test_example.equal_amounts_repayment(i)
            req_sum += expenses

        self.assertEqual(format(req_sum, '.0f'), '200000')
 def perform_repayment(self, repayment):
     try:
         debt = DebtExpenses(int(self.req_sum), float(self.percent_rate),
                             int(self.period))
         if 'equal_amounts' in repayment:
             self.payment, self.expenses = debt.equal_amounts_repayment(
                 int(self.year))
         else:
             self.payment, self.expenses = debt.equal_payments_repayment(
                 int(self.year))
         self.update_error_message()
     except Exception:
         self.update_result()
         self.error_message = 'Error: Incorrect input'
 def test_equal_amounts_repayment_for_invalid_neg_year(self):
     test_example = DebtExpenses(200000, 0.14, 4)
     with self.assertRaises(Exception):
         test_example.equal_amounts_repayment(-6)
 def test_equal_amounts_repayment_for_4_year(self):
     test_example = DebtExpenses(200000, 0.14, 4)
     payment, expenses = test_example.equal_amounts_repayment(4)
     self.assertEqual([format(payment, '.0f'),
                       format(expenses, '.0f')], ['57000', '50000'])