88
99
1010def make_html (style : str , body : str ) -> str :
11- return "<html><head><style>{style}</style></head><body>{body}</body></html>" .format (
12- style = style , body = body
13- )
11+ return "<html><head><style>{style}</style></head><body>{body}</body></html>" .format (style = style , body = body )
1412
1513
1614SAMPLE_STYLE = """h1, h2 { color:red; }
@@ -60,9 +58,7 @@ def test_inline_many_wrong_type():
6058
6159
6260def test_missing_stylesheet ():
63- with pytest .raises (
64- css_inline .InlineError , match = "Missing stylesheet file: tests/missing.css"
65- ):
61+ with pytest .raises (css_inline .InlineError , match = "Missing stylesheet file: tests/missing.css" ):
6662 css_inline .inline (
6763 """<html>
6864<head>
@@ -198,18 +194,17 @@ def test_cache():
198194 color: blue;
199195}
200196"""
201- EXPECTED_INLINED_FRAGMENT = '<main>\n <h1 style="color: blue;">Hello</h1>\n <section>\n <p style="color: red;">who am i</p>\n </section>\n </main>'
197+ EXPECTED_INLINED_FRAGMENT = (
198+ '<main>\n <h1 style="color: blue;">Hello</h1>\n <section>\n <p style="color: red;">who am i</p>\n </section>\n </main>'
199+ )
202200
203201
204202def test_inline_fragment ():
205203 assert css_inline .inline_fragment (FRAGMENT , CSS ) == EXPECTED_INLINED_FRAGMENT
206204
207205
208206def test_inline_fragment_method ():
209- assert (
210- css_inline .CSSInliner ().inline_fragment (FRAGMENT , CSS )
211- == EXPECTED_INLINED_FRAGMENT
212- )
207+ assert css_inline .CSSInliner ().inline_fragment (FRAGMENT , CSS ) == EXPECTED_INLINED_FRAGMENT
213208
214209
215210def test_inline_many_fragments ():
@@ -220,19 +215,15 @@ def test_inline_many_fragments():
220215
221216
222217def test_inline_many_fragments_method ():
223- assert css_inline .CSSInliner ().inline_many_fragments (
224- [FRAGMENT , FRAGMENT ], [CSS , CSS ]
225- ) == [
218+ assert css_inline .CSSInliner ().inline_many_fragments ([FRAGMENT , FRAGMENT ], [CSS , CSS ]) == [
226219 EXPECTED_INLINED_FRAGMENT ,
227220 EXPECTED_INLINED_FRAGMENT ,
228221 ]
229222
230223
231224@pytest .mark .parametrize ("size" , (0 , - 1 , "foo" ))
232225def test_invalid_cache (size ):
233- with pytest .raises (
234- ValueError , match = "Cache size must be an integer greater than zero"
235- ):
226+ with pytest .raises (ValueError , match = "Cache size must be an integer greater than zero" ):
236227 css_inline .StylesheetCache (size = size )
237228
238229
0 commit comments