1
1
import numpy as np
2
2
import pytest
3
3
4
- from pandas import DataFrame , NA
4
+ from pandas import (
5
+ NA ,
6
+ DataFrame ,
7
+ )
5
8
6
9
pytest .importorskip ("jinja2" )
7
10
@@ -312,7 +315,7 @@ def test_bar_color_and_cmap_error_raises():
312
315
msg = "`color` and `cmap` cannot both be given"
313
316
# Test that providing both color and cmap raises a ValueError
314
317
with pytest .raises (ValueError , match = msg ):
315
- df .style .bar (color = ' #d65f5f' , cmap = ' viridis' ).to_html ()
318
+ df .style .bar (color = " #d65f5f" , cmap = " viridis" ).to_html ()
316
319
317
320
318
321
def test_bar_invalid_color_type_error_raises ():
@@ -327,14 +330,14 @@ def test_bar_invalid_color_type_error_raises():
327
330
328
331
# Test that providing a color list with more than two elements raises a ValueError
329
332
with pytest .raises (ValueError , match = msg ):
330
- df .style .bar (color = [' #d65f5f' , ' #5fba7d' , ' #abcdef' ]).to_html ()
333
+ df .style .bar (color = [" #d65f5f" , " #5fba7d" , " #abcdef" ]).to_html ()
331
334
332
335
333
336
def test_styler_bar_with_NA_values ():
334
337
df1 = DataFrame ({"A" : [1 , 2 , NA , 4 ]})
335
338
df2 = DataFrame ([[NA , NA ], [NA , NA ]])
336
339
expected_substring = "style type="
337
- html_output1 = df1 .style .bar (subset = 'A' ).to_html ()
340
+ html_output1 = df1 .style .bar (subset = "A" ).to_html ()
338
341
html_output2 = df2 .style .bar (align = "left" , axis = None ).to_html ()
339
342
assert expected_substring in html_output1
340
343
assert expected_substring in html_output2
0 commit comments