def test_fv_missing_rate(): response = handlers.fv_handler({ "nper": 120, "pmt": -100, "pv": -100 }, None) assert 'error' in response
def test_fv_missing_nper(): response = handlers.fv_handler( { "rate": 0.004166666666667, "pmt": -100, "pv": -100 }, None) assert 'error' in response
def test_fv_handler(): # TODO test data types # rate, nper, pmt response = handlers.fv_handler( { "rate": 0.004166666666667, "nper": 120, "pmt": -100 }, None) assert 'result' in response assert round(response.get('result'), 6) == 15528.227945 # rate, nper, pv response = handlers.fv_handler( { "rate": 0.004166666666667, "nper": 120, "pv": -100 }, None) assert 'result' in response assert round(response.get('result'), 6) == 164.700950 # rate, nper, pmt, pv response = handlers.fv_handler( { "rate": 0.004166666666667, "nper": 120, "pmt": -100, "pv": -100 }, None) assert 'result' in response assert round(response.get('result'), 6) == 15692.928894 # rate, nper, pmt, pv response = handlers.fv_handler( { "rate": 0.004166666666667, "nper": 120, "pmt": -100, "pv": -100, "type": 1 }, None) assert 'result' in response assert round(response.get('result'), 6) == 15757.629844