@@ -112,7 +112,7 @@ def test_get_multi2(self):
112
112
113
113
# sanity checking
114
114
115
- assert np .issubdtype (result .dtype , np .floating )
115
+ self . assertTrue ( np .issubdtype (result .dtype , np .floating ) )
116
116
result = pan .Open .ix ['Jan-15-12' :'Jan-20-12' ]
117
117
self .assertEqual ((4 , 3 ), result .shape )
118
118
assert_n_failed_equals_n_null_columns (w , result )
@@ -121,11 +121,11 @@ def test_get_multi2(self):
121
121
def test_dtypes (self ):
122
122
#GH3995, #GH8980
123
123
data = web .get_data_google ('F' , start = 'JAN-01-10' , end = 'JAN-27-13' )
124
- assert np .issubdtype (data .Open .dtype , np .number )
125
- assert np .issubdtype (data .Close .dtype , np .number )
126
- assert np .issubdtype (data .Low .dtype , np .number )
127
- assert np .issubdtype (data .High .dtype , np .number )
128
- assert np .issubdtype (data .Volume .dtype , np .number )
124
+ self . assertTrue ( np .issubdtype (data .Open .dtype , np .number ) )
125
+ self . assertTrue ( np .issubdtype (data .Close .dtype , np .number ) )
126
+ self . assertTrue ( np .issubdtype (data .Low .dtype , np .number ) )
127
+ self . assertTrue ( np .issubdtype (data .High .dtype , np .number ) )
128
+ self . assertTrue ( np .issubdtype (data .Volume .dtype , np .number ) )
129
129
130
130
@network
131
131
def test_unicode_date (self ):
@@ -183,15 +183,15 @@ def test_get_components_dow_jones(self):
183
183
raise nose .SkipTest ('unreliable test, receive partial components back for dow_jones' )
184
184
185
185
df = web .get_components_yahoo ('^DJI' ) #Dow Jones
186
- assert isinstance (df , pd .DataFrame )
186
+ self . assertIsInstance (df , pd .DataFrame )
187
187
self .assertEqual (len (df ), 30 )
188
188
189
189
@network
190
190
def test_get_components_dax (self ):
191
191
raise nose .SkipTest ('unreliable test, receive partial components back for dax' )
192
192
193
193
df = web .get_components_yahoo ('^GDAXI' ) #DAX
194
- assert isinstance (df , pd .DataFrame )
194
+ self . assertIsInstance (df , pd .DataFrame )
195
195
self .assertEqual (len (df ), 30 )
196
196
self .assertEqual (df [df .name .str .contains ('adidas' , case = False )].index ,
197
197
'ADS.DE' )
@@ -202,13 +202,13 @@ def test_get_components_nasdaq_100(self):
202
202
raise nose .SkipTest ('unreliable test, receive partial components back for nasdaq_100' )
203
203
204
204
df = web .get_components_yahoo ('^NDX' ) #NASDAQ-100
205
- assert isinstance (df , pd .DataFrame )
205
+ self . assertIsInstance (df , pd .DataFrame )
206
206
207
207
if len (df ) > 1 :
208
208
# Usual culprits, should be around for a while
209
- assert 'AAPL' in df .index
210
- assert 'GOOG' in df .index
211
- assert 'AMZN' in df .index
209
+ self . assertTrue ( 'AAPL' in df .index )
210
+ self . assertTrue ( 'GOOG' in df .index )
211
+ self . assertTrue ( 'AMZN' in df .index )
212
212
else :
213
213
expected = DataFrame ({'exchange' : 'N/A' , 'name' : '@^NDX' },
214
214
index = ['@^NDX' ])
@@ -256,7 +256,7 @@ def test_get_data_multiple_symbols_two_dates(self):
256
256
self .assertEqual (len (result ), 3 )
257
257
258
258
# sanity checking
259
- assert np .issubdtype (result .dtype , np .floating )
259
+ self . assertTrue ( np .issubdtype (result .dtype , np .floating ) )
260
260
261
261
expected = np .array ([[18.99 , 28.4 , 25.18 ],
262
262
[18.58 , 28.31 , 25.13 ],
@@ -276,7 +276,7 @@ def test_get_date_ret_index(self):
276
276
self .assertEqual (result , 1.0 )
277
277
278
278
# sanity checking
279
- assert np .issubdtype (pan .values .dtype , np .floating )
279
+ self . assertTrue ( np .issubdtype (pan .values .dtype , np .floating ) )
280
280
281
281
282
282
class TestYahooOptions (tm .TestCase ):
@@ -383,26 +383,26 @@ def test_get_underlying_price(self):
383
383
quote_price = options_object ._underlying_price_from_root (root )
384
384
except RemoteDataError as e :
385
385
raise nose .SkipTest (e )
386
- self .assert_ ( isinstance ( quote_price , float ) )
386
+ self .assertIsInstance ( quote_price , float )
387
387
388
388
def test_sample_page_price_quote_time1 (self ):
389
389
#Tests the weekend quote time format
390
390
price , quote_time = self .aapl ._underlying_price_and_time_from_url (self .html1 )
391
- self .assert_ ( isinstance ( price , (int , float , complex ) ))
392
- self .assert_ ( isinstance ( quote_time , (datetime , Timestamp ) ))
391
+ self .assertIsInstance ( price , (int , float , complex ))
392
+ self .assertIsInstance ( quote_time , (datetime , Timestamp ))
393
393
394
394
def test_chop (self ):
395
395
#regression test for #7625
396
396
self .aapl .chop_data (self .data1 , above_below = 2 , underlying_price = np .nan )
397
397
chopped = self .aapl .chop_data (self .data1 , above_below = 2 , underlying_price = 100 )
398
- self .assert_ ( isinstance ( chopped , DataFrame ) )
398
+ self .assertIsInstance ( chopped , DataFrame )
399
399
self .assertTrue (len (chopped ) > 1 )
400
400
401
401
def test_chop_out_of_strike_range (self ):
402
402
#regression test for #7625
403
403
self .aapl .chop_data (self .data1 , above_below = 2 , underlying_price = np .nan )
404
404
chopped = self .aapl .chop_data (self .data1 , above_below = 2 , underlying_price = 100000 )
405
- self .assert_ ( isinstance ( chopped , DataFrame ) )
405
+ self .assertIsInstance ( chopped , DataFrame )
406
406
self .assertTrue (len (chopped ) > 1 )
407
407
408
408
@@ -411,8 +411,8 @@ def test_sample_page_price_quote_time2(self):
411
411
#Tests the EDT page format
412
412
#regression test for #8741
413
413
price , quote_time = self .aapl ._underlying_price_and_time_from_url (self .html2 )
414
- self .assert_ ( isinstance ( price , (int , float , complex ) ))
415
- self .assert_ ( isinstance ( quote_time , (datetime , Timestamp ) ))
414
+ self .assertIsInstance ( price , (int , float , complex ))
415
+ self .assertIsInstance ( quote_time , (datetime , Timestamp ))
416
416
417
417
@network
418
418
def test_sample_page_chg_float (self ):
@@ -452,26 +452,26 @@ def test_is_s3_url(self):
452
452
@network
453
453
def test_read_yahoo (self ):
454
454
gs = DataReader ("GS" , "yahoo" )
455
- assert isinstance (gs , DataFrame )
455
+ self . assertIsInstance (gs , DataFrame )
456
456
457
457
@network
458
458
def test_read_google (self ):
459
459
gs = DataReader ("GS" , "google" )
460
- assert isinstance (gs , DataFrame )
460
+ self . assertIsInstance (gs , DataFrame )
461
461
462
462
@network
463
463
def test_read_fred (self ):
464
464
vix = DataReader ("VIXCLS" , "fred" )
465
- assert isinstance (vix , DataFrame )
465
+ self . assertIsInstance (vix , DataFrame )
466
466
467
467
@network
468
468
def test_read_famafrench (self ):
469
469
for name in ("F-F_Research_Data_Factors" ,
470
470
"F-F_Research_Data_Factors_weekly" , "6_Portfolios_2x3" ,
471
471
"F-F_ST_Reversal_Factor" , "F-F_Momentum_Factor" ):
472
472
ff = DataReader (name , "famafrench" )
473
- assert ff
474
- assert isinstance (ff , dict )
473
+ self . assertTrue ( ff is not None )
474
+ self . assertIsInstance (ff , dict )
475
475
476
476
477
477
class TestFred (tm .TestCase ):
@@ -498,7 +498,7 @@ def test_fred_nan(self):
498
498
start = datetime (2010 , 1 , 1 )
499
499
end = datetime (2013 , 1 , 27 )
500
500
df = web .DataReader ("DFII5" , "fred" , start , end )
501
- assert pd .isnull (df .ix ['2010-01-01' ][0 ])
501
+ self . assertTrue ( pd .isnull (df .ix ['2010-01-01' ][0 ]) )
502
502
503
503
@network
504
504
def test_fred_parts (self ):
@@ -510,7 +510,7 @@ def test_fred_parts(self):
510
510
self .assertEqual (df .ix ['2010-05-01' ][0 ], 217.23 )
511
511
512
512
t = df .CPIAUCSL .values
513
- assert np .issubdtype (t .dtype , np .floating )
513
+ self . assertTrue ( np .issubdtype (t .dtype , np .floating ) )
514
514
self .assertEqual (t .shape , (37 ,))
515
515
516
516
@network
0 commit comments