Skip to content

Commit

Permalink
Fixes from integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jnothman committed Apr 8, 2017
1 parent c1fc232 commit 8e9a567
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
8 changes: 5 additions & 3 deletions pandas/formats/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@ def build_font(self, props):
'size': size,
'bold': self.BOLD_MAP.get(props.get('font-weight')),
'italic': self.ITALIC_MAP.get(props.get('font-style')),
'underline': (None if decoration is None
else 'underline' in decoration),
'underline': ('single'
if decoration is not None
and 'underline' in decoration
else None),
'strike': (None if decoration is None
else 'line-through' in decoration),
'color': self.color_to_excel(props.get('font-color')),
'color': self.color_to_excel(props.get('color')),
# shadow if nonzero digit before shadow colour
'shadow': (bool(re.search('^[^#(]*[1-9]',
props['text-shadow']))
Expand Down
17 changes: 11 additions & 6 deletions pandas/tests/formats/test_to_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
# - italic
# - underline
('text-decoration: underline',
{'font': {'underline': True, 'strike': False}}),
{'font': {'underline': 'single', 'strike': False}}),
('text-decoration: overline',
{'font': {'underline': False, 'strike': False}}),
{'font': {'strike': False}}),
('text-decoration: none',
{'font': {'underline': False, 'strike': False}}),
{'font': {'strike': False}}),
# - strike
('text-decoration: line-through',
{'font': {'strike': True, 'underline': False}}),
Expand All @@ -56,9 +56,9 @@
('text-decoration: underline; text-decoration: line-through',
{'font': {'strike': True, 'underline': False}}),
# - color
('font-color: red', {'font': {'color': 'FF0000'}}),
('font-color: #ff0000', {'font': {'color': 'FF0000'}}),
('font-color: #f0a', {'font': {'color': 'FF00AA'}}),
('color: red', {'font': {'color': 'FF0000'}}),
('color: #ff0000', {'font': {'color': 'FF0000'}}),
('color: #f0a', {'font': {'color': 'FF00AA'}}),
# - shadow
('text-shadow: none', {'font': {'shadow': False}}),
('text-shadow: 0px -0em 0px #CCC', {'font': {'shadow': False}}),
Expand Down Expand Up @@ -141,3 +141,8 @@ def test_css_to_excel_multiple():
def test_css_to_excel_inherited(css, inherited, expected):
convert = CSSToExcelConverter(inherited)
assert expected == convert(css)


@pytest.mark.xfail
def test_css_to_excel_warns_when_not_supported():
pass

0 comments on commit 8e9a567

Please sign in to comment.