9
9
import pandas as pd
10
10
from pandas import DataFrame
11
11
from pandas .io import data as web
12
- from pandas .io .data import DataReader , SymbolWarning
12
+ from pandas .io .data import DataReader , SymbolWarning , RemoteDataError
13
13
from pandas .util .testing import (assert_series_equal , assert_produces_warning ,
14
14
network , assert_frame_equal )
15
15
import pandas .util .testing as tm
@@ -252,8 +252,8 @@ def tearDownClass(cls):
252
252
def test_get_options_data (self ):
253
253
try :
254
254
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 )
257
257
else :
258
258
assert len (calls )> 1
259
259
assert len (puts )> 1
@@ -269,8 +269,8 @@ def test_get_near_stock_price(self):
269
269
try :
270
270
calls , puts = self .aapl .get_near_stock_price (call = True , put = True ,
271
271
expiry = self .expiry )
272
- except IndexError :
273
- warnings . warn ( "IndexError thrown no tables found" )
272
+ except RemoteDataError as e :
273
+ nose . SkipTest ( e )
274
274
else :
275
275
self .assertEqual (len (calls ), 5 )
276
276
self .assertEqual (len (puts ), 5 )
@@ -279,17 +279,17 @@ def test_get_near_stock_price(self):
279
279
def test_get_call_data (self ):
280
280
try :
281
281
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 )
284
284
else :
285
285
assert len (calls )> 1
286
286
287
287
@network
288
288
def test_get_put_data (self ):
289
289
try :
290
290
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 )
293
293
else :
294
294
assert len (puts )> 1
295
295
@@ -321,8 +321,8 @@ def test_get_options_data_warning(self):
321
321
print ('month: {0}, year: {1}' .format (self .month , self .year ))
322
322
try :
323
323
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 )
326
326
327
327
@network
328
328
def test_get_near_stock_price_warning (self ):
@@ -333,26 +333,26 @@ def test_get_near_stock_price_warning(self):
333
333
put = True ,
334
334
month = self .month ,
335
335
year = self .year )
336
- except IndexError :
337
- warnings . warn ( "IndexError thrown no tables found" )
336
+ except RemoteDataError as e :
337
+ nose . SkipTest ( e )
338
338
339
339
@network
340
340
def test_get_call_data_warning (self ):
341
341
with assert_produces_warning ():
342
342
print ('month: {0}, year: {1}' .format (self .month , self .year ))
343
343
try :
344
344
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 )
347
347
348
348
@network
349
349
def test_get_put_data_warning (self ):
350
350
with assert_produces_warning ():
351
351
print ('month: {0}, year: {1}' .format (self .month , self .year ))
352
352
try :
353
353
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 )
356
356
357
357
358
358
class TestDataReader (tm .TestCase ):
0 commit comments