-
Notifications
You must be signed in to change notification settings - Fork 19
/
tests.py
74 lines (69 loc) · 2.4 KB
/
tests.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from markdown.test_tools import TestCase
from mdx_outline import OutlineExtension
class TestOutline(TestCase):
def test_basic(self):
self.assertMarkdownRenders(
# The Markdown source text used as input
self.dedent(
"""
# 1
Section 1
## 1.1
Subsection 1.1
## 1.2
Subsection 1.2
### 1.2.1
Hey 1.2.1 Special section
### 1.2.2
#### 1.2.2.1
# 2
Section 2
"""
),
# The expected HTML output
self.dedent(
"""
<section class="section1"><h1>1</h1>
<p>Section 1</p>
<section class="section2"><h2>1.1</h2>
<p>Subsection 1.1</p>
</section><section class="section2"><h2>1.2</h2>
<p>Subsection 1.2</p>
<section class="section3"><h3>1.2.1</h3>
<p>Hey 1.2.1 Special section</p>
</section><section class="section3"><h3>1.2.2</h3>
<section class="section4"><h4>1.2.2.1</h4>
</section></section></section></section><section class="section1"><h1>2</h1>
<p>Section 2</p>
</section>
"""
),
# Other keyword arguments to pass to `markdown.markdown`
extensions=[OutlineExtension()],
output_format="html",
)
def test_custom_class(self):
self.assertMarkdownRenders(
# The Markdown source text used as input
self.dedent(
"""
# Introduction
# Body
## Subsection
# Bibliography
"""
),
# The expected HTML output
self.dedent(
"""
<div class="s1"><h1>Introduction</h1>
</div><div class="s1"><h1>Body</h1>
<div class="s2"><h2>Subsection</h2>
</div></div><div class="s1"><h1>Bibliography</h1>
</div>
"""
),
# Other keyword arguments to pass to `markdown.markdown`
extensions=[OutlineExtension(wrapper_tag="div", wrapper_cls="s%(LEVEL)d")],
output_format="html",
)