@@ -2241,6 +2241,7 @@ def style(df):
2241
2241
['' , 'font-style: italic' , '' ],
2242
2242
['' , '' , 'text-align: right' ],
2243
2243
['background-color: red' , '' , '' ],
2244
+ ['number-format: 0%' , '' , '' ],
2244
2245
['' , '' , '' ],
2245
2246
['' , '' , '' ],
2246
2247
['' , '' , '' ]],
@@ -2266,7 +2267,7 @@ def custom_converter(css):
2266
2267
2267
2268
# Prepare spreadsheets
2268
2269
2269
- df = DataFrame (np .random .randn (10 , 3 ))
2270
+ df = DataFrame (np .random .randn (11 , 3 ))
2270
2271
with ensure_clean ('.xlsx' if engine != 'xlwt' else '.xls' ) as path :
2271
2272
writer = ExcelWriter (path , engine = engine )
2272
2273
df .to_excel (writer , sheet_name = 'frame' )
@@ -2294,7 +2295,7 @@ def custom_converter(css):
2294
2295
n_cells += 1
2295
2296
2296
2297
# ensure iteration actually happened:
2297
- assert n_cells == (10 + 1 ) * (3 + 1 )
2298
+ assert n_cells == (11 + 1 ) * (3 + 1 )
2298
2299
2299
2300
# (2) check styling with default converter
2300
2301
@@ -2344,13 +2345,16 @@ def custom_converter(css):
2344
2345
assert cell1 .fill .patternType != cell2 .fill .patternType
2345
2346
assert cell2 .fill .fgColor .rgb == alpha + 'FF0000'
2346
2347
assert cell2 .fill .patternType == 'solid'
2348
+ elif ref == 'B9' :
2349
+ assert cell1 .number_format == 'General'
2350
+ assert cell2 .number_format == '0%'
2347
2351
else :
2348
2352
assert_equal_style (cell1 , cell2 )
2349
2353
2350
2354
assert cell1 .value == cell2 .value
2351
2355
n_cells += 1
2352
2356
2353
- assert n_cells == (10 + 1 ) * (3 + 1 )
2357
+ assert n_cells == (11 + 1 ) * (3 + 1 )
2354
2358
2355
2359
# (3) check styling with custom converter
2356
2360
n_cells = 0
@@ -2359,7 +2363,7 @@ def custom_converter(css):
2359
2363
assert len (col1 ) == len (col2 )
2360
2364
for cell1 , cell2 in zip (col1 , col2 ):
2361
2365
ref = '%s%d' % (cell2 .column , cell2 .row )
2362
- if ref in ('B2' , 'C3' , 'D4' , 'B5' , 'C6' , 'D7' , 'B8' ):
2366
+ if ref in ('B2' , 'C3' , 'D4' , 'B5' , 'C6' , 'D7' , 'B8' , 'B9' ):
2363
2367
assert not cell1 .font .bold
2364
2368
assert cell2 .font .bold
2365
2369
else :
@@ -2368,7 +2372,7 @@ def custom_converter(css):
2368
2372
assert cell1 .value == cell2 .value
2369
2373
n_cells += 1
2370
2374
2371
- assert n_cells == (10 + 1 ) * (3 + 1 )
2375
+ assert n_cells == (11 + 1 ) * (3 + 1 )
2372
2376
2373
2377
2374
2378
@td .skip_if_no ('openpyxl' )
0 commit comments