@@ -1066,14 +1066,10 @@ def test_to_html_regression_GH6098(self):
10661066 df .pivot_table (index = [u ('clé1' )], columns = [u ('clé2' )])._repr_html_ ()
10671067
10681068 def test_to_html_truncate (self ):
1069- pytest .skip ("unreliable on travis" )
10701069 index = pd .DatetimeIndex (start = '20010101' , freq = 'D' , periods = 20 )
10711070 df = DataFrame (index = index , columns = range (20 ))
1072- fmt .set_option ('display.max_rows' , 8 )
1073- fmt .set_option ('display.max_columns' , 4 )
1074- result = df ._repr_html_ ()
1071+ result = df .to_html (max_rows = 8 , max_cols = 4 )
10751072 expected = '''\
1076- <div{0}>
10771073 <table border="1" class="dataframe">
10781074 <thead>
10791075 <tr style="text-align: right;">
@@ -1159,23 +1155,15 @@ def test_to_html_truncate(self):
11591155 <td>NaN</td>
11601156 </tr>
11611157 </tbody>
1162- </table>
1163- <p>20 rows × 20 columns</p>
1164- </div>''' .format (div_style )
1165- if compat .PY2 :
1166- expected = expected .decode ('utf-8' )
1158+ </table>'''
11671159 assert result == expected
11681160
11691161 def test_to_html_truncate_multi_index (self ):
1170- pytest .skip ("unreliable on travis" )
11711162 arrays = [['bar' , 'bar' , 'baz' , 'baz' , 'foo' , 'foo' , 'qux' , 'qux' ],
11721163 ['one' , 'two' , 'one' , 'two' , 'one' , 'two' , 'one' , 'two' ]]
11731164 df = DataFrame (index = arrays , columns = arrays )
1174- fmt .set_option ('display.max_rows' , 7 )
1175- fmt .set_option ('display.max_columns' , 7 )
1176- result = df ._repr_html_ ()
1165+ result = df .to_html (max_rows = 7 , max_cols = 7 )
11771166 expected = '''\
1178- <div{0}>
11791167 <table border="1" class="dataframe">
11801168 <thead>
11811169 <tr>
@@ -1276,24 +1264,16 @@ def test_to_html_truncate_multi_index(self):
12761264 <td>NaN</td>
12771265 </tr>
12781266 </tbody>
1279- </table>
1280- <p>8 rows × 8 columns</p>
1281- </div>''' .format (div_style )
1282- if compat .PY2 :
1283- expected = expected .decode ('utf-8' )
1267+ </table>'''
12841268 assert result == expected
12851269
1270+ @pytest .mark .xfail (reason = 'GH22887 TypeError' , strict = True )
12861271 def test_to_html_truncate_multi_index_sparse_off (self ):
1287- pytest .skip ("unreliable on travis" )
12881272 arrays = [['bar' , 'bar' , 'baz' , 'baz' , 'foo' , 'foo' , 'qux' , 'qux' ],
12891273 ['one' , 'two' , 'one' , 'two' , 'one' , 'two' , 'one' , 'two' ]]
12901274 df = DataFrame (index = arrays , columns = arrays )
1291- fmt .set_option ('display.max_rows' , 7 )
1292- fmt .set_option ('display.max_columns' , 7 )
1293- fmt .set_option ('display.multi_sparse' , False )
1294- result = df ._repr_html_ ()
1275+ result = df .to_html (max_rows = 7 , max_cols = 7 , sparsify = False )
12951276 expected = '''\
1296- <div{0}>
12971277 <table border="1" class="dataframe">
12981278 <thead>
12991279 <tr>
@@ -1387,11 +1367,7 @@ def test_to_html_truncate_multi_index_sparse_off(self):
13871367 <td>NaN</td>
13881368 </tr>
13891369 </tbody>
1390- </table>
1391- <p>8 rows × 8 columns</p>
1392- </div>''' .format (div_style )
1393- if compat .PY2 :
1394- expected = expected .decode ('utf-8' )
1370+ </table>'''
13951371 assert result == expected
13961372
13971373 def test_to_html_border (self ):
0 commit comments