25
25
from pandas .util .testing import (assert_frame_equal , network ,
26
26
get_data_path )
27
27
28
- from pandas .util .testing import makeCustomDataframe as mkdf , rands
28
+ from pandas .util .testing import makeCustomDataframe as mkdf
29
29
30
30
31
31
def _have_module (module_name ):
@@ -157,12 +157,12 @@ def test_spam(self):
157
157
def test_spam_no_match (self ):
158
158
dfs = self .run_read_html (self .spam_data )
159
159
for df in dfs :
160
- self .assertIsInstance ( df , DataFrame )
160
+ self .assert_ ( isinstance ( df , DataFrame ) )
161
161
162
162
def test_banklist_no_match (self ):
163
163
dfs = self .run_read_html (self .banklist_data , attrs = {'id' : 'table' })
164
164
for df in dfs :
165
- self .assertIsInstance ( df , DataFrame )
165
+ self .assert_ ( isinstance ( df , DataFrame ) )
166
166
167
167
def test_spam_header (self ):
168
168
df = self .run_read_html (self .spam_data , '.*Water.*' , header = 0 )
@@ -301,9 +301,9 @@ def test_file_url(self):
301
301
url = self .banklist_data
302
302
dfs = self .run_read_html ('file://' + url , 'First' ,
303
303
attrs = {'id' : 'table' })
304
- self .assertIsInstance ( dfs , list )
304
+ self .assert_ ( isinstance ( dfs , list ) )
305
305
for df in dfs :
306
- self .assertIsInstance ( df , DataFrame )
306
+ self .assert_ ( isinstance ( df , DataFrame ) )
307
307
308
308
@slow
309
309
def test_invalid_table_attrs (self ):
@@ -319,38 +319,38 @@ def _bank_data(self, *args, **kwargs):
319
319
@slow
320
320
def test_multiindex_header (self ):
321
321
df = self ._bank_data (header = [0 , 1 ])[0 ]
322
- self .assertIsInstance ( df .columns , MultiIndex )
322
+ self .assert_ ( isinstance ( df .columns , MultiIndex ) )
323
323
324
324
@slow
325
325
def test_multiindex_index (self ):
326
326
df = self ._bank_data (index_col = [0 , 1 ])[0 ]
327
- self .assertIsInstance ( df .index , MultiIndex )
327
+ self .assert_ ( isinstance ( df .index , MultiIndex ) )
328
328
329
329
@slow
330
330
def test_multiindex_header_index (self ):
331
331
df = self ._bank_data (header = [0 , 1 ], index_col = [0 , 1 ])[0 ]
332
- self .assertIsInstance ( df .columns , MultiIndex )
333
- self .assertIsInstance ( df .index , MultiIndex )
332
+ self .assert_ ( isinstance ( df .columns , MultiIndex ) )
333
+ self .assert_ ( isinstance ( df .index , MultiIndex ) )
334
334
335
335
@slow
336
336
def test_multiindex_header_skiprows (self ):
337
337
df = self ._bank_data (header = [0 , 1 ], skiprows = 1 )[0 ]
338
- self .assertIsInstance ( df .columns , MultiIndex )
338
+ self .assert_ ( isinstance ( df .columns , MultiIndex ) )
339
339
340
340
@slow
341
341
def test_multiindex_header_index_skiprows (self ):
342
342
df = self ._bank_data (header = [0 , 1 ], index_col = [0 , 1 ], skiprows = 1 )[0 ]
343
- self .assertIsInstance ( df .index , MultiIndex )
343
+ self .assert_ ( isinstance ( df .index , MultiIndex ) )
344
344
345
345
@slow
346
346
def test_regex_idempotency (self ):
347
347
url = self .banklist_data
348
348
dfs = self .run_read_html ('file://' + url ,
349
349
match = re .compile (re .compile ('Florida' )),
350
350
attrs = {'id' : 'table' })
351
- self .assertIsInstance ( dfs , list )
351
+ self .assert_ ( isinstance ( dfs , list ) )
352
352
for df in dfs :
353
- self .assertIsInstance ( df , DataFrame )
353
+ self .assert_ ( isinstance ( df , DataFrame ) )
354
354
355
355
def test_negative_skiprows_spam (self ):
356
356
url = self .spam_data
@@ -367,15 +367,15 @@ def test_multiple_matches(self):
367
367
url = 'http://code.google.com/p/pythonxy/wiki/StandardPlugins'
368
368
dfs = self .run_read_html (url , match = 'Python' ,
369
369
attrs = {'class' : 'wikitable' })
370
- self .assertGreater (len (dfs ), 1 )
370
+ self .assert_ (len (dfs ) > 1 )
371
371
372
372
@network
373
373
def test_pythonxy_plugins_table (self ):
374
374
url = 'http://code.google.com/p/pythonxy/wiki/StandardPlugins'
375
375
dfs = self .run_read_html (url , match = 'Python' ,
376
376
attrs = {'class' : 'wikitable' })
377
377
zz = [df .iloc [0 , 0 ] for df in dfs ]
378
- self .assertListEqual (sorted (zz ), sorted (['Python' , 'SciTE' ]))
378
+ self .assertEqual (sorted (zz ), sorted (['Python' , 'SciTE' ]))
379
379
380
380
@slow
381
381
def test_banklist_header (self ):
@@ -391,7 +391,7 @@ def try_remove_ws(x):
391
391
ground_truth = read_csv (os .path .join (DATA_PATH , 'banklist.csv' ),
392
392
converters = {'Updated Date' : Timestamp ,
393
393
'Closing Date' : Timestamp })
394
- self .assertTupleEqual (df .shape , ground_truth .shape )
394
+ self .assertEqual (df .shape , ground_truth .shape )
395
395
old = ['First Vietnamese American BankIn Vietnamese' ,
396
396
'Westernbank Puerto RicoEn Espanol' ,
397
397
'R-G Premier Bank of Puerto RicoEn Espanol' ,
@@ -422,7 +422,7 @@ def test_gold_canyon(self):
422
422
self .assert_ (gc in raw_text )
423
423
df = self .run_read_html (self .banklist_data , 'Gold Canyon' ,
424
424
attrs = {'id' : 'table' }, infer_types = False )[0 ]
425
- self .assertIn (gc , df .to_string ())
425
+ self .assert_ (gc in df .to_string ())
426
426
427
427
428
428
class TestReadHtmlLxml (TestCase ):
@@ -449,8 +449,8 @@ def test_banklist_data_fail(self):
449
449
def test_works_on_valid_markup (self ):
450
450
filename = os .path .join (DATA_PATH , 'valid_markup.html' )
451
451
dfs = self .run_read_html (filename , index_col = 0 , flavor = ['lxml' ])
452
- self .assertIsInstance ( dfs , list )
453
- self .assertIsInstance ( dfs [0 ], DataFrame )
452
+ self .assert_ ( isinstance ( dfs , list ) )
453
+ self .assert_ ( isinstance ( dfs [0 ], DataFrame ) )
454
454
455
455
def setUp (self ):
456
456
self .try_skip ()
0 commit comments