99import pandas as pd
1010from pandas import DataFrame
1111from pandas .io import data as web
12- from pandas .io .data import DataReader , SymbolWarning
12+ from pandas .io .data import DataReader , SymbolWarning , RemoteDataError
1313from pandas .util .testing import (assert_series_equal , assert_produces_warning ,
1414 network , assert_frame_equal )
1515import pandas .util .testing as tm
@@ -252,8 +252,8 @@ def tearDownClass(cls):
252252 def test_get_options_data (self ):
253253 try :
254254 calls , puts = self .aapl .get_options_data (expiry = self .expiry )
255- except IndexError :
256- warnings . warn ( "IndexError thrown no tables found" )
255+ except RemoteDataError as e :
256+ nose . SkipTest ( e )
257257 else :
258258 assert len (calls )> 1
259259 assert len (puts )> 1
@@ -269,8 +269,8 @@ def test_get_near_stock_price(self):
269269 try :
270270 calls , puts = self .aapl .get_near_stock_price (call = True , put = True ,
271271 expiry = self .expiry )
272- except IndexError :
273- warnings . warn ( "IndexError thrown no tables found" )
272+ except RemoteDataError as e :
273+ nose . SkipTest ( e )
274274 else :
275275 self .assertEqual (len (calls ), 5 )
276276 self .assertEqual (len (puts ), 5 )
@@ -279,17 +279,17 @@ def test_get_near_stock_price(self):
279279 def test_get_call_data (self ):
280280 try :
281281 calls = self .aapl .get_call_data (expiry = self .expiry )
282- except IndexError :
283- warnings . warn ( "IndexError thrown no tables found" )
282+ except RemoteDataError as e :
283+ nose . SkipTest ( e )
284284 else :
285285 assert len (calls )> 1
286286
287287 @network
288288 def test_get_put_data (self ):
289289 try :
290290 puts = self .aapl .get_put_data (expiry = self .expiry )
291- except IndexError :
292- warnings . warn ( "IndexError thrown no tables found" )
291+ except RemoteDataError as e :
292+ nose . SkipTest ( e )
293293 else :
294294 assert len (puts )> 1
295295
@@ -321,8 +321,8 @@ def test_get_options_data_warning(self):
321321 print ('month: {0}, year: {1}' .format (self .month , self .year ))
322322 try :
323323 self .aapl .get_options_data (month = self .month , year = self .year )
324- except IndexError :
325- warnings . warn ( "IndexError thrown no tables found" )
324+ except RemoteDataError as e :
325+ nose . SkipTest ( e )
326326
327327 @network
328328 def test_get_near_stock_price_warning (self ):
@@ -333,26 +333,26 @@ def test_get_near_stock_price_warning(self):
333333 put = True ,
334334 month = self .month ,
335335 year = self .year )
336- except IndexError :
337- warnings . warn ( "IndexError thrown no tables found" )
336+ except RemoteDataError as e :
337+ nose . SkipTest ( e )
338338
339339 @network
340340 def test_get_call_data_warning (self ):
341341 with assert_produces_warning ():
342342 print ('month: {0}, year: {1}' .format (self .month , self .year ))
343343 try :
344344 self .aapl .get_call_data (month = self .month , year = self .year )
345- except IndexError :
346- warnings . warn ( "IndexError thrown no tables found" )
345+ except RemoteDataError as e :
346+ nose . SkipTest ( e )
347347
348348 @network
349349 def test_get_put_data_warning (self ):
350350 with assert_produces_warning ():
351351 print ('month: {0}, year: {1}' .format (self .month , self .year ))
352352 try :
353353 self .aapl .get_put_data (month = self .month , year = self .year )
354- except IndexError :
355- warnings . warn ( "IndexError thrown no tables found" )
354+ except RemoteDataError as e :
355+ nose . SkipTest ( e )
356356
357357
358358class TestDataReader (tm .TestCase ):
0 commit comments