Skip to content

Commit 8e9a567

Browse files
committed
Fixes from integration testing
1 parent c1fc232 commit 8e9a567

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

pandas/formats/excel.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,13 @@ def build_font(self, props):
237237
'size': size,
238238
'bold': self.BOLD_MAP.get(props.get('font-weight')),
239239
'italic': self.ITALIC_MAP.get(props.get('font-style')),
240-
'underline': (None if decoration is None
241-
else 'underline' in decoration),
240+
'underline': ('single'
241+
if decoration is not None
242+
and 'underline' in decoration
243+
else None),
242244
'strike': (None if decoration is None
243245
else 'line-through' in decoration),
244-
'color': self.color_to_excel(props.get('font-color')),
246+
'color': self.color_to_excel(props.get('color')),
245247
# shadow if nonzero digit before shadow colour
246248
'shadow': (bool(re.search('^[^#(]*[1-9]',
247249
props['text-shadow']))

pandas/tests/formats/test_to_excel.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
# - italic
4444
# - underline
4545
('text-decoration: underline',
46-
{'font': {'underline': True, 'strike': False}}),
46+
{'font': {'underline': 'single', 'strike': False}}),
4747
('text-decoration: overline',
48-
{'font': {'underline': False, 'strike': False}}),
48+
{'font': {'strike': False}}),
4949
('text-decoration: none',
50-
{'font': {'underline': False, 'strike': False}}),
50+
{'font': {'strike': False}}),
5151
# - strike
5252
('text-decoration: line-through',
5353
{'font': {'strike': True, 'underline': False}}),
@@ -56,9 +56,9 @@
5656
('text-decoration: underline; text-decoration: line-through',
5757
{'font': {'strike': True, 'underline': False}}),
5858
# - color
59-
('font-color: red', {'font': {'color': 'FF0000'}}),
60-
('font-color: #ff0000', {'font': {'color': 'FF0000'}}),
61-
('font-color: #f0a', {'font': {'color': 'FF00AA'}}),
59+
('color: red', {'font': {'color': 'FF0000'}}),
60+
('color: #ff0000', {'font': {'color': 'FF0000'}}),
61+
('color: #f0a', {'font': {'color': 'FF00AA'}}),
6262
# - shadow
6363
('text-shadow: none', {'font': {'shadow': False}}),
6464
('text-shadow: 0px -0em 0px #CCC', {'font': {'shadow': False}}),
@@ -141,3 +141,8 @@ def test_css_to_excel_multiple():
141141
def test_css_to_excel_inherited(css, inherited, expected):
142142
convert = CSSToExcelConverter(inherited)
143143
assert expected == convert(css)
144+
145+
146+
@pytest.mark.xfail
147+
def test_css_to_excel_warns_when_not_supported():
148+
pass

0 commit comments

Comments
 (0)