Beispiel #1
0
def test_npv_missing_values():
    response = handlers.npv_handler({
        "rate": 0.281,
    }, None)

    assert 'error' in response
    assert response.get('error') == REQUIRED_PROPERTY_ERR.format("values")
Beispiel #2
0
def test_npv_handler():
    # TODO test data types

    response = handlers.npv_handler(
        {
            "rate": 0.1,
            "values": [-10000, 3000, 4200, 6800]
        }, None)
    assert 'result' in response
    assert round(response.get('result'), 5) == 1188.44341
def test_npv_handler():
    # TODO test data types

    # TODO Why doesn't the Excel calc match the NumPy calc?
    response = handlers.npv_handler(
        {
            "rate": 0.1,
            "values": [-1000, 3000, 4200, 6800]
        }, None)
    assert 'result' in response
    assert round(response.get('result'), 8) == 1188.44341
def test_npv_handler():
    # TODO test data types

    # TODO Why doesn't the Excel calc match the NumPy calc?
    response = handlers.npv_handler(
        {
            "rate": 0.1,
            "values": [-1000, 3000, 4200, 6800]
        }, None)
    assert 'result' in response
    assert response.get('result') == pytest.approx(
        10307.287753568744)  #1188.44341
Beispiel #5
0
def test_npv_missing_rate():
    response = handlers.npv_handler({"values": [-100, 39, 59, 55, 20]}, None)

    assert 'error' in response
    assert response.get('error') == REQUIRED_PROPERTY_ERR.format("rate")