|
1 | 1 | import pytest |
2 | 2 |
|
| 3 | +from pandas.util import testing as tm |
3 | 4 | from pandas.io.formats.css import CSSResolver, CSSWarning |
4 | 5 |
|
5 | 6 |
|
@@ -35,20 +36,23 @@ def test_css_parse_comments(): |
35 | 36 |
|
36 | 37 |
|
37 | 38 | @pytest.mark.xfail(reason='''we don't need to handle specificity |
38 | | - markers like !important, but we should |
39 | | - ignore them in the future''') |
| 39 | + markers like !important, but we should |
| 40 | + ignore them in the future''') |
40 | 41 | def test_css_parse_specificity(): |
41 | 42 | assert_same_resolution('font-weight: bold', 'font-weight: bold !important') |
42 | 43 |
|
43 | 44 |
|
44 | 45 | @pytest.mark.xfail(reason='Splitting CSS declarations not yet sensitive to ' |
45 | | - '; in CSS strings') |
| 46 | + '; in CSS strings') |
46 | 47 | def test_css_parse_strings(): |
47 | 48 | # semicolons in strings |
48 | | - assert_resolves('background-image: url(\'http://blah.com/foo?a;b=c\')', |
49 | | - {'background-image': 'url(\'http://blah.com/foo?a;b=c\')'}) |
50 | | - assert_resolves('background-image: url("http://blah.com/foo?a;b=c")', |
51 | | - {'background-image': 'url("http://blah.com/foo?a;b=c")'}) |
| 49 | + with tm.assert_produces_warning(CSSWarning): |
| 50 | + assert_resolves( |
| 51 | + 'background-image: url(\'http://blah.com/foo?a;b=c\')', |
| 52 | + {'background-image': 'url(\'http://blah.com/foo?a;b=c\')'}) |
| 53 | + assert_resolves( |
| 54 | + 'background-image: url("http://blah.com/foo?a;b=c")', |
| 55 | + {'background-image': 'url("http://blah.com/foo?a;b=c")'}) |
52 | 56 |
|
53 | 57 |
|
54 | 58 | @pytest.mark.parametrize( |
@@ -77,7 +81,7 @@ def test_css_parse_strings(): |
77 | 81 | ('font-size: 10 pt', 'font-size: 1em'), |
78 | 82 | ]) |
79 | 83 | def test_css_parse_invalid(invalid_css, remainder): |
80 | | - with pytest.warns(CSSWarning): |
| 84 | + with tm.assert_produces_warning(CSSWarning): |
81 | 85 | assert_same_resolution(invalid_css, remainder) |
82 | 86 |
|
83 | 87 | # TODO: we should be checking that in other cases no warnings are raised |
@@ -115,7 +119,7 @@ def test_css_side_shorthands(shorthand, expansions): |
115 | 119 | {top: '1pt', right: '4pt', |
116 | 120 | bottom: '2pt', left: '0pt'}) |
117 | 121 |
|
118 | | - with pytest.warns(CSSWarning): |
| 122 | + with tm.assert_produces_warning(CSSWarning): |
119 | 123 | assert_resolves('%s: 1pt 1pt 1pt 1pt 1pt' % shorthand, |
120 | 124 | {}) |
121 | 125 |
|
|
0 commit comments