Exemplo n.º 1
0
def test_calculate_financials(summary_df, econ_df, discountto,
                              expected_results):
    """Parametrized testing of presentvalue computations from dataframes"""
    pv_df = presentvalue.calc_presentvalue_df(summary_df, econ_df, discountto)
    fin = presentvalue.calculate_financials(pv_df, 3000)
    for key, value in expected_results.items():
        assert np.isclose(fin[key], value)
Exemplo n.º 2
0
def test_calc_pv_irr():
    """A single test of the IRR functionality"""
    results = presentvalue.calculate_financials(IRR_DF, 2100)
    assert np.isclose(results["IRR"], 20)  # remember 20 % higher income in year 2.
    assert np.isclose(presentvalue.calc_pv_irr(results["IRR"], IRR_DF, 2100), 0.0)
    assert presentvalue.calc_pv_irr(results["IRR"] / 2, IRR_DF, 2100) > 0.0
    assert presentvalue.calc_pv_irr(results["IRR"] * 2, IRR_DF, 2100) < 0.0