Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 7 additions & 31 deletions pandas/tests/io/formats/test_to_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,14 +1066,10 @@ def test_to_html_regression_GH6098(self):
df.pivot_table(index=[u('clé1')], columns=[u('clé2')])._repr_html_()

def test_to_html_truncate(self):
pytest.skip("unreliable on travis")
index = pd.DatetimeIndex(start='20010101', freq='D', periods=20)
df = DataFrame(index=index, columns=range(20))
fmt.set_option('display.max_rows', 8)
fmt.set_option('display.max_columns', 4)
result = df._repr_html_()
result = df.to_html(max_rows=8, max_cols=4)
expected = '''\
<div{0}>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
Expand Down Expand Up @@ -1159,23 +1155,15 @@ def test_to_html_truncate(self):
<td>NaN</td>
</tr>
</tbody>
</table>
<p>20 rows × 20 columns</p>
</div>'''.format(div_style)
if compat.PY2:
expected = expected.decode('utf-8')
</table>'''
assert result == expected

def test_to_html_truncate_multi_index(self):
pytest.skip("unreliable on travis")
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
df = DataFrame(index=arrays, columns=arrays)
fmt.set_option('display.max_rows', 7)
fmt.set_option('display.max_columns', 7)
result = df._repr_html_()
result = df.to_html(max_rows=7, max_cols=7)
expected = '''\
<div{0}>
<table border="1" class="dataframe">
<thead>
<tr>
Expand Down Expand Up @@ -1276,24 +1264,16 @@ def test_to_html_truncate_multi_index(self):
<td>NaN</td>
</tr>
</tbody>
</table>
<p>8 rows × 8 columns</p>
</div>'''.format(div_style)
if compat.PY2:
expected = expected.decode('utf-8')
</table>'''
assert result == expected

@pytest.mark.xfail(reason='GH22887 TypeError', strict=True)
def test_to_html_truncate_multi_index_sparse_off(self):
pytest.skip("unreliable on travis")
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
df = DataFrame(index=arrays, columns=arrays)
fmt.set_option('display.max_rows', 7)
fmt.set_option('display.max_columns', 7)
fmt.set_option('display.multi_sparse', False)
result = df._repr_html_()
result = df.to_html(max_rows=7, max_cols=7, sparsify=False)
expected = '''\
<div{0}>
<table border="1" class="dataframe">
<thead>
<tr>
Expand Down Expand Up @@ -1387,11 +1367,7 @@ def test_to_html_truncate_multi_index_sparse_off(self):
<td>NaN</td>
</tr>
</tbody>
</table>
<p>8 rows × 8 columns</p>
</div>'''.format(div_style)
if compat.PY2:
expected = expected.decode('utf-8')
</table>'''
assert result == expected

def test_to_html_border(self):
Expand Down