def __init__(self, loan_at=0.1, stick_price=0, deposit_amount=0, px_amount=0, term=4, depreciation_id=None, loan_at_end=0): # print loan_at, loan_at_end, depreciation_id, deposit_amount, term, stick_price self.loan_at = loan_at self.total_months = term * 12 self.total_up_front = deposit_amount + px_amount self.px_amount = px_amount self.finance_value = stick_price - self.total_up_front self.loan_at_end = loan_at_end if depreciation_id is None: raise Exception('Invalid car version') depreciation = Depreciation.objects.get(pk=depreciation_id) depr_profile = DepreciationProfile( depreciation.get_raw_data(), int_to_str(stick_price) ) last_depr = depr_profile.exact_depreciations[-1] self.last_depr = last_depr.amount
def test_int_to_str(self): self.assertEqual(utils.int_to_str(123456), '123,456')