Skip to content

TST: remove some xfailing test_css.py tests #16272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 1 addition & 75 deletions pandas/tests/io/formats/test_css.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,14 @@ def test_css_parse_normalisation(name, norm, abnorm):
assert_same_resolution(norm, abnorm)


@pytest.mark.xfail(reason='CSS comments not yet stripped')
def test_css_parse_comments():
assert_same_resolution('hello: world',
'hello/* foo */:/* bar \n */ world /*;not:here*/')


@pytest.mark.xfail(reason='''we don't need to handle specificity
markers like !important, but we should
ignore them in the future''')
def test_css_parse_specificity():
assert_same_resolution('font-weight: bold', 'font-weight: bold !important')


@pytest.mark.xfail(reason='Splitting CSS declarations not yet sensitive to '
'; in CSS strings')
def test_css_parse_strings():
# semicolons in strings
with tm.assert_produces_warning(CSSWarning):
assert_resolves(
'background-image: url(\'http://blah.com/foo?a;b=c\')',
{'background-image': 'url(\'http://blah.com/foo?a;b=c\')'})
assert_resolves(
'background-image: url("http://blah.com/foo?a;b=c")',
{'background-image': 'url("http://blah.com/foo?a;b=c")'})


@pytest.mark.parametrize(
'invalid_css,remainder', [
# No colon
('hello-world', ''),
('border-style: solid; hello-world', 'border-style: solid'),
('border-style: solid; hello-world; font-weight: bold',
'border-style: solid; font-weight: bold'),
# Unclosed string
pytest.mark.xfail(('background-image: "abc', ''),
reason='Unclosed CSS strings not detected'),
pytest.mark.xfail(('font-family: "abc', ''),
reason='Unclosed CSS strings not detected'),
pytest.mark.xfail(('background-image: \'abc', ''),
reason='Unclosed CSS strings not detected'),
pytest.mark.xfail(('font-family: \'abc', ''),
reason='Unclosed CSS strings not detected'),
# Unclosed string fail
# Invalid size
('font-size: blah', 'font-size: 1em'),
('font-size: 1a2b', 'font-size: 1em'),
Expand Down Expand Up @@ -124,46 +90,6 @@ def test_css_side_shorthands(shorthand, expansions):
{})


@pytest.mark.xfail(reason='CSS font shorthand not yet handled')
@pytest.mark.parametrize('css,props', [
('font: italic bold 12pt helvetica,sans-serif',
{'font-family': 'helvetica,sans-serif',
'font-style': 'italic',
'font-weight': 'bold',
'font-size': '12pt'}),
('font: bold italic 12pt helvetica,sans-serif',
{'font-family': 'helvetica,sans-serif',
'font-style': 'italic',
'font-weight': 'bold',
'font-size': '12pt'}),
])
def test_css_font_shorthand(css, props):
assert_resolves(css, props)


@pytest.mark.xfail(reason='CSS background shorthand not yet handled')
@pytest.mark.parametrize('css,props', [
('background: blue', {'background-color': 'blue'}),
('background: fixed blue',
{'background-color': 'blue', 'background-attachment': 'fixed'}),
])
def test_css_background_shorthand(css, props):
assert_resolves(css, props)


@pytest.mark.xfail(reason='CSS border shorthand not yet handled')
@pytest.mark.parametrize('style,equiv', [
('border: 1px solid red',
'border-width: 1px; border-style: solid; border-color: red'),
('border: solid red 1px',
'border-width: 1px; border-style: solid; border-color: red'),
('border: red solid',
'border-style: solid; border-color: red'),
])
def test_css_border_shorthand(style, equiv):
assert_same_resolution(style, equiv)


@pytest.mark.parametrize('style,inherited,equiv', [
('margin: 1px; margin: 2px', '',
'margin: 2px'),
Expand Down
17 changes: 1 addition & 16 deletions pandas/tests/io/formats/test_to_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,7 @@
('text-shadow: 0px -0em 2px #CCC', {'font': {'shadow': True}}),
('text-shadow: 0px -0em 2px', {'font': {'shadow': True}}),
('text-shadow: 0px -2em', {'font': {'shadow': True}}),
pytest.mark.xfail(('text-shadow: #CCC 3px 3px 3px',
{'font': {'shadow': True}}),
reason='text-shadow with color preceding width not yet '
'identified as shadow'),
pytest.mark.xfail(('text-shadow: #999 0px 0px 0px',
{'font': {'shadow': False}}),
reason='text-shadow with color preceding zero width not '
'yet identified as non-shadow'),

# FILL
# - color, fillType
('background-color: red', {'fill': {'fgColor': 'FF0000',
Expand Down Expand Up @@ -209,11 +202,3 @@ 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(reason='We are not currently warning for all unconverted '
'CSS, but possibly should')
def test_css_to_excel_warns_when_not_supported():
convert = CSSToExcelConverter()
with pytest.warns(UserWarning):
convert('background: red')