Beispiel #1
0
def test_pv_missing_rate():
    response = handlers.pv_handler({
        "nper": 120,
        "pmt": -100,
        "fv": 15692.93
    }, None)

    assert 'error' in response
Beispiel #2
0
def test_pv_missing_nper():
    response = handlers.pv_handler(
        {
            "rate": 0.004166666666666666,
            "pmt": -100,
            "fv": 15692.93
        }, None)

    assert 'error' in response
Beispiel #3
0
def test_pv_handler():
    # TODO test data types
    response = handlers.pv_handler(
        {
            "rate": 0.004166666666666666,
            "nper": 120,
            "pmt": -100
        }, None)
    assert 'result' in response
    assert round(response.get('result'), 6) == 9428.135033

    response = handlers.pv_handler(
        {
            "rate": 0.004166666666666666,
            "nper": 120,
            "fv": 15692.93
        }, None)
    assert 'result' in response
    assert round(response.get('result'), 6) == -9528.135704

    response = handlers.pv_handler(
        {
            "rate": 0.004166666666666666,
            "nper": 120,
            "pmt": -100,
            "fv": 15692.93
        }, None)
    assert 'result' in response
    assert round(response.get('result'), 6) == -100.000671

    response = handlers.pv_handler(
        {
            "rate": 0.004166666666666666,
            "nper": 120,
            "pmt": -100,
            "fv": 15692.93,
            "type": 1
        }, None)
    assert 'result' in response
    assert round(response.get('result'), 6) == -60.716775