Skip to content

Commit 7edd0d5

Browse files
committed
Add tests
1 parent aa78113 commit 7edd0d5

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

tests/test_api/test_main.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from markdown_it import MarkdownIt
2+
from markdown_it.token import Token
23

34

45
def test_load_presets():
@@ -90,3 +91,92 @@ def test_reset():
9091
"inline": ["text"],
9192
"inline2": ["balance_pairs", "text_collapse"],
9293
}
94+
95+
96+
def test_parseInline():
97+
md = MarkdownIt()
98+
tokens = md.parseInline("abc\n\n> xyz")
99+
assert tokens == [
100+
Token(
101+
type="inline",
102+
tag="",
103+
nesting=0,
104+
attrs=None,
105+
map=[0, 1],
106+
level=0,
107+
children=[
108+
Token(
109+
type="text",
110+
tag="",
111+
nesting=0,
112+
attrs=None,
113+
map=None,
114+
level=0,
115+
children=None,
116+
content="abc",
117+
markup="",
118+
info="",
119+
meta={},
120+
block=False,
121+
hidden=False,
122+
),
123+
Token(
124+
type="softbreak",
125+
tag="br",
126+
nesting=0,
127+
attrs=None,
128+
map=None,
129+
level=0,
130+
children=None,
131+
content="",
132+
markup="",
133+
info="",
134+
meta={},
135+
block=False,
136+
hidden=False,
137+
),
138+
Token(
139+
type="softbreak",
140+
tag="br",
141+
nesting=0,
142+
attrs=None,
143+
map=None,
144+
level=0,
145+
children=None,
146+
content="",
147+
markup="",
148+
info="",
149+
meta={},
150+
block=False,
151+
hidden=False,
152+
),
153+
Token(
154+
type="text",
155+
tag="",
156+
nesting=0,
157+
attrs=None,
158+
map=None,
159+
level=0,
160+
children=None,
161+
content="> xyz",
162+
markup="",
163+
info="",
164+
meta={},
165+
block=False,
166+
hidden=False,
167+
),
168+
],
169+
content="abc\n\n> xyz",
170+
markup="",
171+
info="",
172+
meta={},
173+
block=False,
174+
hidden=False,
175+
)
176+
]
177+
178+
179+
def test_renderInline():
180+
md = MarkdownIt("zero")
181+
tokens = md.renderInline("abc\n\n*xyz*")
182+
assert tokens == "abc\n\n*xyz*"

0 commit comments

Comments
 (0)