@@ -83,8 +83,6 @@ def test_get_data(self):
83
83
sl = ['AAPL' , 'AMZN' , 'GOOG' ]
84
84
pan = web .get_data_yahoo (sl , '2012' )
85
85
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
88
86
assert ts [0 ].dayofyear == 96
89
87
90
88
dfi = web .get_components_yahoo ('^DJI' )
@@ -93,33 +91,29 @@ def test_get_data(self):
93
91
result = pan .Close .ix ['01-18-12' ][['GE' , 'MSFT' , 'INTC' ]].tolist ()
94
92
assert result == expected
95
93
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
-
103
94
# sanity checking
104
95
t = np .array (result )
105
96
assert np .issubdtype (t .dtype , np .floating )
106
97
assert t .shape == (3 ,)
107
98
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
118
113
119
114
# sanity checking
120
- t = np .array (result )
115
+ t = np .array (pan )
121
116
assert np .issubdtype (t .dtype , np .floating )
122
- assert t .shape == (4 , 3 )
123
117
124
118
125
119
if __name__ == '__main__' :
0 commit comments