Skip to content

Commit aec5875

Browse files
author
David Stephens
committed
TST: Change dividend actions test to AAPL
1 parent 44ee8c8 commit aec5875

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

pandas_datareader/tests/yahoo/test_yahoo.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,25 @@ def test_get_date_ret_index(self):
199199

200200
def test_get_data_yahoo_actions(self):
201201
start = datetime(1990, 1, 1)
202-
end = datetime(2000, 4, 5)
202+
end = datetime(2018, 4, 5)
203203

204-
actions = web.get_data_yahoo_actions('BHP.AX', start, end,
205-
adjust_dividends=True)
204+
actions = web.get_data_yahoo_actions('AAPL', start, end,
205+
adjust_dividends=False)
206+
207+
assert sum(actions['action'] == 'DIVIDEND') == 47
208+
assert sum(actions['action'] == 'SPLIT') == 3
206209

207-
assert sum(actions['action'] == 'DIVIDEND') == 21
208-
assert sum(actions['action'] == 'SPLIT') == 1
210+
assert actions.loc['2005-02-28', 'action'][0] == 'SPLIT'
211+
assert actions.loc['2005-02-28', 'value'][0] == 1/2.0
209212

210-
assert actions.loc['1995-05-11', 'action'][0] == 'SPLIT'
211-
assert actions.loc['1995-05-11', 'value'][0] == 1 / 1.1
213+
assert actions.loc['1995-11-21', 'action'][0] == 'DIVIDEND'
214+
assert round(actions.loc['1995-11-21', 'value'][0], 3) == 0.120
215+
216+
actions = web.get_data_yahoo_actions('AAPL', start, end,
217+
adjust_dividends=True)
212218

213-
assert actions.loc['1993-05-10', 'action'][0] == 'DIVIDEND'
214-
assert actions.loc['1993-05-10', 'value'][0] == 0.21
219+
assert actions.loc['1995-11-21', 'action'][0] == 'DIVIDEND'
220+
assert round(actions.loc['1995-11-21', 'value'][0], 4) == 0.0043
215221

216222
def test_get_data_yahoo_actions_invalid_symbol(self):
217223
start = datetime(1990, 1, 1)

0 commit comments

Comments
 (0)