@@ -83,8 +83,6 @@ def test_get_data(self):
8383 sl = ['AAPL' , 'AMZN' , 'GOOG' ]
8484 pan = web .get_data_yahoo (sl , '2012' )
8585 ts = pan .Close .GOOG .index [pan .Close .AAPL > pan .Close .GOOG ]
86- # the provider results are subject to change, disabled. GH2847
87- # assert result == expected
8886 assert ts [0 ].dayofyear == 96
8987
9088 dfi = web .get_components_yahoo ('^DJI' )
@@ -93,33 +91,29 @@ def test_get_data(self):
9391 result = pan .Close .ix ['01-18-12' ][['GE' , 'MSFT' , 'INTC' ]].tolist ()
9492 assert result == expected
9593
96- pan = web .get_data_yahoo (dfi , 'JAN-01-12' , 'JAN-31-12' ,
97- adjust_price = True )
98- expected = [18.38 , 27.45 , 24.54 ]
99- result = pan .Close .ix ['01-18-12' ][['GE' , 'MSFT' , 'INTC' ]].tolist ()
100- # the provider results are subject to change, disabled. GH2847
101- # assert result == expected
102-
10394 # sanity checking
10495 t = np .array (result )
10596 assert np .issubdtype (t .dtype , np .floating )
10697 assert t .shape == (3 ,)
10798
108- pan = web .get_data_yahoo (dfi , '2011' , ret_index = True )
109- d = [[ 1.01757469 , 1.01130524 , 1.02414183 ],
110- [ 1.00292912 , 1.00770812 , 1.01735194 ],
111- [ 1.00820152 , 1.00462487 , 1.01320257 ],
112- [ 1.08025776 , 0.99845838 , 1.00113165 ]]
113-
114- expected = pd .DataFrame (d )
115- result = pan .Ret_Index .ix ['01-18-11' :'01-21-11' ][['GE' , 'INTC' , 'MSFT' ]]
116- # the provider results are subject to change, disabled. GH2847
117- # assert_almost_equal(result.values, expected.values)
99+ expected = [[ 18.99 , 28.4 , 25.18 ],
100+ [ 18.58 , 28.31 , 25.13 ],
101+ [ 19.03 , 28.16 , 25.52 ],
102+ [ 18.81 , 28.82 , 25.87 ]]
103+ result = pan .Open .ix ['Jan-15-12' :'Jan-20-12' ][['GE' , 'MSFT' , 'INTC' ]].values
104+ assert (result == expected ).all ()
105+
106+ #Check ret_index
107+ pan = web .get_data_yahoo (['GE' , 'INTC' , 'IBM' ], '1977' , '1987' ,
108+ ret_index = True )
109+ tstamp = pan .Ret_Index .INTC .first_valid_index ()
110+ result = pan .Ret_Index .ix [tstamp ]['INTC' ]
111+ expected = 1.0
112+ assert result == expected
118113
119114 # sanity checking
120- t = np .array (result )
115+ t = np .array (pan )
121116 assert np .issubdtype (t .dtype , np .floating )
122- assert t .shape == (4 , 3 )
123117
124118
125119if __name__ == '__main__' :
0 commit comments