Skip to content

Commit

Permalink
test: use Relative tolerance for SPY.US tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chilango74 committed Jun 19, 2021
1 parent a0a1a55 commit 3436edd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/test_asset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pytest import mark
from pytest import approx
import pandas as pd


Expand All @@ -18,7 +19,7 @@ def test_close(init_asset_spy):


def test_adj_close(init_asset_spy):
assert init_asset_spy.adj_close.loc['2000-01-20'] == 97.3802
assert init_asset_spy.adj_close.loc['2000-01-20'] == approx(97.0629, rel=1e-2)


def test_price(init_asset_spy):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_asset_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def test_ror(self):
assert_frame_equal(self.asset_list_lt.assets_ror, asset_list_lt_sample)
assert_frame_equal(self.currencies.assets_ror, currencies_sample)
assert_frame_equal(self.real_estate.assets_ror, real_estate_sample)
assert_frame_equal(self.spy.assets_ror, spy_sample)
# SPY adj_close and ror is changing over time
assert_frame_equal(self.spy.assets_ror, spy_sample, rtol=1e-2)

def test_currencies(self):
assert self.currencies.pl.years == 1
Expand Down

0 comments on commit 3436edd

Please sign in to comment.