-
Notifications
You must be signed in to change notification settings - Fork 23
/
test_inlinestyler.py
44 lines (35 loc) · 1.02 KB
/
test_inlinestyler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import unicode_literals
from inlinestyler.utils import inline_css
def test_no_markup():
inlined = inline_css("Hello World!")
expected = '<html><body><p>Hello World!</p></body></html>\n'
assert expected == inlined
def test_respects_encoding_argument():
inlined = inline_css("Hello World!", encoding='utf-16')
expected = '<html><body><p>Hello World!</p></body></html>\n'.encode('utf-16')
assert expected == inlined
def test_inline_css_in_head():
document = """
<html>
<head>
<style>
.emphasis {
font-weight: bold;
}
</style>
</head>
<body>
Hello <span class="emphasis">World</span>!
</body>
</html>
"""
expected = """<html>
<head>
</head>
<body>
Hello <span class="emphasis" style="font-weight: bold">World</span>!
</body>
</html>
"""
inlined = inline_css(document)
assert expected == inlined