Skip to content

Commit

Permalink
TST: coverage for skipped tests in io/formats/test_to_html.py (pandas…
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins authored and Pingviinituutti committed Feb 28, 2019
1 parent 57b1d48 commit 3deaaf3
Showing 1 changed file with 7 additions and 31 deletions.
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

0 comments on commit 3deaaf3

Please sign in to comment.