File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,23 @@ def test_to_string_with_col_space(self):
189
189
c30 = len (df .to_string (col_space = 30 ).split ("\n " )[1 ])
190
190
self .assertTrue ( c10 < c20 < c30 )
191
191
192
+ def test_to_html_with_col_space (self ):
193
+ def check_with_width (df ,col_space ):
194
+ import re
195
+ # check that col_space affects HTML generation
196
+ # and be very brittle about it.
197
+ html = df .to_html (col_space = col_space )
198
+ hdrs = [x for x in html .split ("\n " ) if re .search ("<th[>\s]" ,x )]
199
+ self .assertTrue (len (hdrs ) > 0 )
200
+ for h in hdrs :
201
+ self .assertTrue ("min-width" in h )
202
+ self .assertTrue (str (col_space ) in h )
203
+
204
+ df = DataFrame (np .random .random (size = (1 ,3 )))
205
+
206
+ check_with_width (df ,30 )
207
+ check_with_width (df ,50 )
208
+
192
209
def test_to_html_unicode (self ):
193
210
# it works!
194
211
df = DataFrame ({u'\u03c3 ' : np .arange (10. )})
You can’t perform that action at this time.
0 commit comments