-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_htmlparser.py
More file actions
32 lines (25 loc) · 833 Bytes
/
Copy pathtest_htmlparser.py
File metadata and controls
32 lines (25 loc) · 833 Bytes
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
import pathlib
from textwrap import dedent
from htmlobj.html_parser import main
HERE = pathlib.Path(__file__).resolve().parent
def test_from_file():
"""html_parser can render an html file to code"""
expected = dedent(
"""\
h = HTML()
with h.html:
with h.head:
h.title("My Page")
with h.body:
with h.p:
with h.u:
h.raw_text('Paragraph 1 underlined')
with h.p(class_="p2"):
h.raw_text('Paragraph 2, >1 ')
h.b("bold")
h.raw_text(', not bold')"""
)
html_file = HERE / "test_files" / "simple1.html"
args = ["", html_file.as_uri(), "12"] # 8 lines
result = main(args)
assert result == expected