@@ -611,20 +611,15 @@ def test_to_html_render_links(render_links, expected, datapath):
611
611
assert result == expected
612
612
613
613
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
+ ])
614
618
@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 ):
616
620
# see gh-17004
617
621
df = DataFrame ([lorem_ipsum ])
618
622
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 )
621
625
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