Skip to content

Commit 0ed79e4

Browse files
committed
ENH: add named based column css styling to pandas Styler (black fixup)
1 parent 4c1eb64 commit 0ed79e4

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

pandas/tests/io/formats/test_style.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,26 +1689,21 @@ def test_no_cell_ids(self):
16891689
assert s.find('<td class="data row0 col0" >') != -1
16901690

16911691
def test_extending_table_styles(self):
1692-
df = pd.DataFrame(data=[[0, 1], [1, 2]], columns=['A', 'B'])
1693-
styler = df.style.set_table_styles([{
1694-
'selector': '',
1695-
'props': [('background-color', 'yellow')]}]
1696-
).extend_table_styles([{
1697-
'selector': '.col0',
1698-
'props': [('background-color', 'blue')]}]
1692+
df = pd.DataFrame(data=[[0, 1], [1, 2]], columns=["A", "B"])
1693+
styler = df.style.set_table_styles(
1694+
[{"selector": "", "props": [("background-color", "yellow")]}]
1695+
).extend_table_styles(
1696+
[{"selector": ".col0", "props": [("background-color", "blue")]}]
16991697
)
17001698
assert len(styler.table_styles) == 2
17011699

17021700
def test_column_styling(self):
1703-
df = pd.DataFrame(data=[[0, 1], [1, 2]], columns=['A', 'B'])
1704-
s = Styler(df, uuid='_')
1705-
s = s.extend_column_styles({
1706-
'A': [{
1707-
'selector': '',
1708-
'props': [('color', 'blue')]
1709-
}]
1710-
})
1711-
assert '#T__ .col0 {\n color: blue;\n }' in s.render()
1701+
df = pd.DataFrame(data=[[0, 1], [1, 2]], columns=["A", "B"])
1702+
s = Styler(df, uuid="_")
1703+
s = s.extend_column_styles(
1704+
{"A": [{"selector": "", "props": [("color", "blue")]}]}
1705+
)
1706+
assert "#T__ .col0 {\n color: blue;\n }" in s.render()
17121707

17131708

17141709
@td.skip_if_no_mpl

0 commit comments

Comments
 (0)