Skip to content

Commit

Permalink
test: add test for dividends_annual property in Portfolio
Browse files Browse the repository at this point in the history
  • Loading branch information
vkhomyakov committed Dec 21, 2023
1 parent 5a93f15 commit 7aac739
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def init_portfolio_values():
first_date="2015-01",
last_date="2020-01",
inflation=True,
rebalancing_period="year",
rebalancing_period="annually",
symbol="pf1.PF",
)

Expand Down
3 changes: 3 additions & 0 deletions tests/test_portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ def test_dividends(portfolio_dividends):
def test_dividend_yield(portfolio_dividends):
assert portfolio_dividends.dividend_yield.iloc[-1] == approx(0.0396, abs=1e-2)

def test_dividends_annual(portfolio_dividends):
assert portfolio_dividends.dividends_annual.iloc[-1].sum() == approx(32.778668, rel=1e-3)


def test_risk(portfolio_rebalanced_month):
assert portfolio_rebalanced_month.risk_monthly == approx(0.02233, rel=1e-1)
Expand Down

0 comments on commit 7aac739

Please sign in to comment.