|
10 | 10 |
|
11 | 11 | import pandas_datareader.data as web
|
12 | 12 | from pandas_datareader.data import YahooDailyReader
|
13 |
| -from pandas_datareader.yahoo.quotes import _yahoo_codes |
14 | 13 | from pandas_datareader._utils import RemoteDataError
|
15 | 14 | from pandas_datareader._testing import skip_on_exception
|
16 | 15 |
|
@@ -39,41 +38,39 @@ def test_yahoo_fails(self):
|
39 | 38 | with pytest.raises(Exception):
|
40 | 39 | web.DataReader('NON EXISTENT TICKER', 'yahoo', start, end)
|
41 | 40 |
|
42 |
| - @pytest.mark.skip('Yahoo quotes deprecated') |
43 | 41 | def test_get_quote_series(self):
|
| 42 | + stringlist = ['GOOG', 'AAPL'] |
| 43 | + fields = ['exchange', 'sharesOutstanding', 'epsForward'] |
44 | 44 | try:
|
45 |
| - df = web.get_quote_yahoo(pd.Series(['GOOG', 'AAPL', 'GOOG'])) |
| 45 | + AAPL = web.get_quote_yahoo('AAPL') |
| 46 | + df = web.get_quote_yahoo(pd.Series(stringlist)) |
46 | 47 | except ConnectionError:
|
47 | 48 | pytest.xfail(reason=XFAIL_REASON)
|
48 |
| - tm.assert_series_equal(df.iloc[0], df.iloc[2]) |
| 49 | + tm.assert_series_equal(AAPL.iloc[0][fields], df.loc['AAPL'][fields]) |
| 50 | + assert sorted(stringlist) == sorted(list(df.index.values)) |
49 | 51 |
|
50 |
| - @pytest.mark.skip('Yahoo quotes deprecated') |
51 | 52 | def test_get_quote_string(self):
|
52 |
| - _yahoo_codes.update({'MarketCap': 'j1'}) |
53 | 53 | try:
|
54 | 54 | df = web.get_quote_yahoo('GOOG')
|
55 | 55 | except ConnectionError:
|
56 | 56 | pytest.xfail(reason=XFAIL_REASON)
|
57 | 57 |
|
58 |
| - assert not pd.isnull(df['MarketCap'][0]) |
| 58 | + assert not pd.isnull(df['marketCap'][0]) |
59 | 59 |
|
60 |
| - @pytest.mark.skip('Yahoo quotes deprecated') |
61 | 60 | def test_get_quote_stringlist(self):
|
| 61 | + stringlist = ['GOOG', 'AAPL'] |
62 | 62 | try:
|
63 |
| - df = web.get_quote_yahoo(['GOOG', 'AAPL', 'GOOG']) |
| 63 | + df = web.get_quote_yahoo(stringlist) |
64 | 64 | except ConnectionError:
|
65 | 65 | pytest.xfail(reason=XFAIL_REASON)
|
66 |
| - tm.assert_series_equal(df.iloc[0], df.iloc[2]) |
| 66 | + assert sorted(stringlist) == sorted(list(df.index.values)) |
67 | 67 |
|
68 |
| - @pytest.mark.skip('Yahoo quotes deprecated') |
69 | 68 | def test_get_quote_comma_name(self):
|
70 |
| - _yahoo_codes.update({'name': 'n'}) |
71 | 69 | try:
|
72 | 70 | df = web.get_quote_yahoo(['RGLD'])
|
73 | 71 | except ConnectionError:
|
74 | 72 | pytest.xfail(reason=XFAIL_REASON)
|
75 |
| - del _yahoo_codes['name'] |
76 |
| - assert df['name'][0] == 'Royal Gold, Inc.' |
| 73 | + assert df['longName'][0] == 'Royal Gold, Inc.' |
77 | 74 |
|
78 | 75 | @pytest.mark.skip('Unreliable test, receive partial '
|
79 | 76 | 'components back for dow_jones')
|
|
0 commit comments