File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,8 @@ def _write_cell(
195
195
esc = {}
196
196
197
197
rs = pprint_thing (s , escape_chars = esc ).strip ()
198
+ # replace spaces betweens strings with non-breaking spaces
199
+ rs = rs .replace (" " , " " )
198
200
199
201
if self .render_links and is_url (rs ):
200
202
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):
375
375
(None , "{:.3f}" , "None" ),
376
376
("" , "{:.2f}" , "" ),
377
377
(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
378
390
],
379
391
)
380
392
def test_repr_float_formatting_html_output (
381
393
self , data , format_option , expected_values
382
394
):
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 :
384
401
df = DataFrame ({"A" : [data ]})
385
402
html_output = df ._repr_html_ ()
386
403
assert expected_values in html_output
You can’t perform that action at this time.
0 commit comments