Exemple #1
0
 def test_it_works(self):
     self.assertEquals(loan_calculator(100000, 12, 12), 112000)
Exemple #2
0
 def test_time(self):
     self.assertEquals(loan_calculator(100000, 12, -10), 'invalid time')
Exemple #3
0
 def test_rate(self):
     self.assertEquals(loan_calculator(100000, -18, 10), 'invalid rate')
Exemple #4
0
 def test_inputs(self):
     self.assertEquals(loan_calculator("12000", "12", "45"),
                       'invalid input')
Exemple #5
0
 def test_amount(self):
     self.assertEquals(loan_calculator(0, 12, 10), 'invalid amount')
Exemple #6
0
 def test_loan_calculator_returns_correct_repayment_value(self):
     self.assertEqual(loan_calculator(100000, 12, 12), 112000,
                      'The formula does not work')
 def test_month_is_not_greater_than_twelve(self):
     self.assertEquals(loan_calculator(100000, 11, 13), "Invalid Number of months!")
 def test_rate_is_not_greater_than_hundred(self):
     self.assertEquals(loan_calculator(100000, 101, 13), "Invalid rate!")
 def test_amount_is_not_negative(self):
     self.assertEquals(loan_calculator(-895, 12, 1), "Invalid amount!", "Loan amount should not be negative!")
 def test_loan_is_a_float(self):
     loan = loan_calculator(100000, 12, 1)
     self.assertIsInstance(loan, float, "The returned loan should be a float")