8000 TST/CLN: refactor tests\io\formats\test_to_html.py by simonjayhawkins · Pull Request #23747 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TST/CLN: refactor tests\io\formats\test_to_html.py #23747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 17, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor
  • Loading branch information
simonjayhawkins committed Nov 16, 2018
commit b87756eba3aef2c88d0458f6ef05408d698571d3
26 changes: 13 additions & 13 deletions pandas/tests/io/formats/test_to_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def check_with_width(df, col_space):
check_with_width(df, 50)

def test_to_html_with_empty_string_label(self):
# GH3547, to_html regards empty string labels as repeated labels
# GH 3547, to_html regards empty string labels as repeated labels
data = {'c1': ['a', 'b'], 'c2': ['a', ''], 'data': [1, 2]}
df = DataFrame(data).set_index(['c1', 'c2'])
result = df.to_html()
Expand Down Expand Up @@ -235,7 +235,7 @@ def test_to_html_border(self):

def test_to_html_border_option(self):
df = DataFrame({'A': [1, 2]})
with pd.option_context('display.html.border', 0):
with option_context('display.html.border', 0):
result = df.to_html()
assert 'border="0"' in result
assert 'border="0"' in df._repr_html_()
Expand Down Expand Up @@ -339,7 +339,7 @@ def test_to_html_justify(self, justify, datapath):
@pytest.mark.parametrize("justify", ["super-right", "small-left",
"noinherit", "tiny", "pandas"])
def test_to_html_invalid_justify(self, justify):
# see gh-17527
# GH 17527
df = DataFrame()
msg = "Invalid value for justify parameter"

Expand Down Expand Up @@ -422,7 +422,7 @@ def test_to_html_truncation_index_false_max_rows(self, datapath, index):
[1.867558, -0.977278],
[0.950088, -0.151357],
[-0.103219, 0.410599]]
df = pd.DataFrame(data)
df = DataFrame(data)
result = df.to_html(max_rows=4, index=index)
expected = expected_html(datapath, 'gh15019_expected_output')
assert result == expected
Expand All @@ -432,35 +432,35 @@ def test_to_html_truncation_index_false_max_cols(self, datapath, index):
# GH 22783
data = [[1.764052, 0.400157, 0.978738, 2.240893, 1.867558],
[-0.977278, 0.950088, -0.151357, -0.103219, 0.410599]]
df = pd.DataFrame(data)
df = DataFrame(data)
result = df.to_html(max_cols=4, index=index)
expected = expected_html(datapath, 'gh22783_expected_output')
assert result == expected

def test_to_html_notebook_has_style(self):
df = pd.DataFrame({"A": [1, 2, 3]})
df = DataFrame({"A": [1, 2, 3]})
result = df.to_html(notebook=True)
assert "tbody tr th:only-of-type" in result
assert "vertical-align: middle;" in result
assert "thead th" in result

def test_to_html_notebook_has_no_style(self):
df = pd.DataFrame({"A": [1, 2, 3]})
df = DataFrame({"A": [1, 2, 3]})
result = df.to_html()
assert "tbody tr th:only-of-type" not in result
assert "vertical-align: middle;" not in result
assert "thead th" not in result

def test_to_html_with_index_names_false(self):
# gh-16493
df = pd.DataFrame({"A": [1, 2]}, index=pd.Index(['a', 'b'],
name='myindexname'))
# GH 16493
df = DataFrame({"A": [1, 2]}, index=Index(['a', 'b'],
name='myindexname'))
result = df.to_html(index_names=False)
assert 'myindexname' not in result

def test_to_html_with_id(self):
# gh-8496
df = pd.DataFrame({"A": [1, 2]}, index=pd.Index(['a', 'b'],
name='myindexname'))
# GH 8496
df = DataFrame({"A": [1, 2]}, index=Index(['a', 'b'],
name='myindexname'))
result = df.to_html(index_names=False, table_id="TEST_ID")
assert ' id="TEST_ID"' in result
0