Skip to content

Commit b7f0539

Browse files
committed
test: add test for Portfolio.dcf.wealth_index
1 parent 2f39afc commit b7f0539

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/portfolio/test_cashflow.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ def test_initial_investment_pv_and_fv(dcf_percentage_halfyear):
134134
assert dcf.initial_investment_fv == pytest.approx(expected_fv, rel=1e-12)
135135

136136

137+
def test_wealth_index_pv_less_than_fv(dcf_indexation_yearly):
138+
"""Test that wealth_index[0] with discounting='pv' is less than with discounting='fv'."""
139+
dcf = dcf_indexation_yearly
140+
# Get wealth index with both discounting methods
141+
wi_fv = dcf.wealth_index(discounting="fv", include_negative_values=False)
142+
wi_pv = dcf.wealth_index(discounting="pv", include_negative_values=False)
143+
# First value with PV discounting should be less than with FV discounting
144+
assert wi_pv.iloc[0, 0] < wi_fv.iloc[0, 0]
145+
146+
137147
def test_monte_carlo_wealth_shapes(dcf_indexation_yearly):
138148
dcf = dcf_indexation_yearly
139149
# Small MC for speed (set via properties to avoid distribution_parameters validation)

0 commit comments

Comments
 (0)