Skip to content

Commit e07775d

Browse files
combine test cases
1 parent ad1e83c commit e07775d

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

pandas/tests/io/formats/test_to_html.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -611,20 +611,15 @@ def test_to_html_render_links(render_links, expected, datapath):
611611
assert result == expected
612612

613613

614+
@pytest.mark.parametrize('method,expected', [
615+
('to_html', lambda x:lorem_ipsum),
616+
('_repr_html_', lambda x:lorem_ipsum[:x - 4] + '...') # regression case
617+
])
614618
@pytest.mark.parametrize('max_colwidth', [10, 20, 50, 100])
615-
def test_display_max_colwidth(max_colwidth):
619+
def test_ignore_display_max_colwidth(method, expected, max_colwidth):
616620
# see gh-17004
617621
df = DataFrame([lorem_ipsum])
618622
with pd.option_context('display.max_colwidth', max_colwidth):
619-
result = df._repr_html_()
620-
expected = lorem_ipsum[:max_colwidth - 4] + '...'
623+
result = getattr(df, method)()
624+
expected = expected(max_colwidth)
621625
assert expected in result
622-
623-
624-
@pytest.mark.parametrize('max_colwidth', [10, 20, 50, 100])
625-
def test_ignore_display_max_colwidth(max_colwidth):
626-
# see gh-17004
627-
df = DataFrame([lorem_ipsum])
628-
with pd.option_context('display.max_colwidth', max_colwidth):
629-
result = df.to_html()
630-
assert lorem_ipsum in result

0 commit comments

Comments
 (0)