File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,8 @@ def _write_cell(
195195 esc = {}
196196
197197 rs = pprint_thing (s , escape_chars = esc ).strip ()
198+ # replace spaces betweens strings with non-breaking spaces
199+ rs = rs .replace (" " , " " )
198200
199201 if self .render_links and is_url (rs ):
200202 rs_unescaped = pprint_thing (s , escape_chars = {}).strip ()
Original file line number Diff line number Diff line change @@ -375,12 +375,29 @@ def test_repr_min_rows(self):
375375 (None , "{:.3f}" , "None" ),
376376 ("" , "{:.2f}" , "" ),
377377 (112345.6789 , "{:6.3f}" , "112345.679" ),
378+ ("foo foo" , None , "foo foo" ),
379+ (" foo" , None , "foo" ),
380+ (
381+ "foo foo foo" ,
382+ None ,
383+ "foo foo foo" ,
384+ ), # odd no.of spaces
385+ (
386+ "foo foo foo" ,
387+ None ,
388+ "foo foo foo" ,
389+ ), # even no.of spaces
378390 ],
379391 )
380392 def test_repr_float_formatting_html_output (
381393 self , data , format_option , expected_values
382394 ):
383- with option_context ("display.float_format" , format_option .format ):
395+ if format_option is not None :
396+ with option_context ("display.float_format" , format_option .format ):
397+ df = DataFrame ({"A" : [data ]})
398+ html_output = df ._repr_html_ ()
399+ assert expected_values in html_output
400+ else :
384401 df = DataFrame ({"A" : [data ]})
385402 html_output = df ._repr_html_ ()
386403 assert expected_values in html_output
You can’t perform that action at this time.
0 commit comments