Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chilango74 committed Oct 8, 2024
1 parent 73eef15 commit c593a51
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
71 changes: 34 additions & 37 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ def init_portfolio_values():
inflation=True,
rebalancing_period="year",
symbol="pf1.PF",
cashflow=0,
initial_amount=1_000,
discount_rate=None,
)


Expand Down Expand Up @@ -156,40 +153,40 @@ def portfolio_dividends(init_portfolio_values):


# DCF Scenarios
@pytest.fixture(scope="package")
def portfolio_cashflows_inflation(init_portfolio_values):
_portfolio_cashflows_inflation = deepcopy(init_portfolio_values)
_portfolio_cashflows_inflation["cashflow"] = -100
_portfolio_cashflows_inflation["initial_amount"] = 100_000
return ok.Portfolio(**_portfolio_cashflows_inflation)


@pytest.fixture(scope="package")
def portfolio_cashflows_NO_inflation(init_portfolio_values):
_portfolio_cashflows_NO_inflation = deepcopy(init_portfolio_values)
_portfolio_cashflows_NO_inflation["cashflow"] = -100.0
_portfolio_cashflows_NO_inflation["initial_amount"] = 100_000.0
_portfolio_cashflows_NO_inflation["inflation"] = False
_portfolio_cashflows_NO_inflation["discount_rate"] = 0.09
return ok.Portfolio(**_portfolio_cashflows_NO_inflation)


@pytest.fixture(scope="package")
def portfolio_cashflows_NO_inflation_NO_discount_rate(init_portfolio_values):
_portfolio_cashflows_NO_inflation_NO_discount_rate = deepcopy(init_portfolio_values)
_portfolio_cashflows_NO_inflation_NO_discount_rate["cashflow"] = -100.0
_portfolio_cashflows_NO_inflation_NO_discount_rate["initial_amount"] = 100_000.0
_portfolio_cashflows_NO_inflation_NO_discount_rate["inflation"] = False
_portfolio_cashflows_NO_inflation_NO_discount_rate["discount_rate"] = None
return ok.Portfolio(**_portfolio_cashflows_NO_inflation_NO_discount_rate)


@pytest.fixture(scope="package")
def portfolio_cashflows_inflation_large_cf(init_portfolio_values):
_portfolio_cashflows_inflation_large_cf = deepcopy(init_portfolio_values)
_portfolio_cashflows_inflation_large_cf["cashflow"] = -2000
_portfolio_cashflows_inflation_large_cf["initial_amount"] = 100_000
return ok.Portfolio(**_portfolio_cashflows_inflation_large_cf)
# @pytest.fixture(scope="package")
# def portfolio_cashflows_inflation(init_portfolio_values):
# _portfolio_cashflows_inflation = deepcopy(init_portfolio_values)
# _portfolio_cashflows_inflation["cashflow"] = -100
# _portfolio_cashflows_inflation["initial_amount"] = 100_000
# return ok.Portfolio(**_portfolio_cashflows_inflation)
#
#
# @pytest.fixture(scope="package")
# def portfolio_cashflows_NO_inflation(init_portfolio_values):
# _portfolio_cashflows_NO_inflation = deepcopy(init_portfolio_values)
# _portfolio_cashflows_NO_inflation["cashflow"] = -100.0
# _portfolio_cashflows_NO_inflation["initial_amount"] = 100_000.0
# _portfolio_cashflows_NO_inflation["inflation"] = False
# _portfolio_cashflows_NO_inflation["discount_rate"] = 0.09
# return ok.Portfolio(**_portfolio_cashflows_NO_inflation)
#
#
# @pytest.fixture(scope="package")
# def portfolio_cashflows_NO_inflation_NO_discount_rate(init_portfolio_values):
# _portfolio_cashflows_NO_inflation_NO_discount_rate = deepcopy(init_portfolio_values)
# _portfolio_cashflows_NO_inflation_NO_discount_rate["cashflow"] = -100.0
# _portfolio_cashflows_NO_inflation_NO_discount_rate["initial_amount"] = 100_000.0
# _portfolio_cashflows_NO_inflation_NO_discount_rate["inflation"] = False
# _portfolio_cashflows_NO_inflation_NO_discount_rate["discount_rate"] = None
# return ok.Portfolio(**_portfolio_cashflows_NO_inflation_NO_discount_rate)
#
#
# @pytest.fixture(scope="package")
# def portfolio_cashflows_inflation_large_cf(init_portfolio_values):
# _portfolio_cashflows_inflation_large_cf = deepcopy(init_portfolio_values)
# _portfolio_cashflows_inflation_large_cf["cashflow"] = -2000
# _portfolio_cashflows_inflation_large_cf["initial_amount"] = 100_000
# return ok.Portfolio(**_portfolio_cashflows_inflation_large_cf)


# Macro
Expand Down
5 changes: 4 additions & 1 deletion tests/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ python_files = test_*
python_classes = Test*
python_functions = test_*
xfail_strict = true
addopts = -n auto -p no:warnings
addopts = -n auto
filterwarnings =
ignore::FutureWarning


markers =
smoke: All critical smoke tests
Expand Down
2 changes: 1 addition & 1 deletion tests/test_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_close_daily(init_asset_spy, init_asset_usdrub):

def test_close_monthly(init_asset_spy):
# changed in 2022 MAY from 139.5625
# changed in 2024 MAY from 139.625 to 139.5625
# changed in 2024 OCT from 139.625 to 139.5625
assert init_asset_spy.close_monthly.loc["2000-01"] == 139.5625


Expand Down

0 comments on commit c593a51

Please sign in to comment.