-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
54 lines (43 loc) · 1.54 KB
/
test.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
import textwrap
from markdown_it import MarkdownIt
from mdit_py_emoji import emoji_plugin
def test_emoji_default():
md = MarkdownIt().use(emoji_plugin)
assert md.renderInline(":star: mdit-py-emoji! :star:")
assert (
md.renderInline("Is shortcut supported too :/? :white_check_mark:")
== "Is shortcut supported too 😕? ✅"
)
def test_replace_shortcut():
md = MarkdownIt().use(
emoji_plugin,
shortcuts={
"arrow_up": [":up_arrow:", ":up_arr:"],
"arrow_down": [":down_arrow:", ":down_arr:"],
},
) # Some tricks like `false = False`
assert md.renderInline(":down_arr: Go Down :down_arrow:") == "⬇️ Go Down ⬇️"
def test_ignoring():
md = MarkdownIt().use(emoji_plugin)
assert md.renderInline("https://github.com/") == "https://github.com/"
assert (
md.renderInline("colon separated values(:starry:milk:)")
== "colon separated values(:starry:milk:)"
)
assert md.render("`:arrow_up:` :arrow_up:") == "<p><code>:arrow_up:</code> ⬆️</p>\n"
assert (
md.render(
textwrap.dedent(
"""\
<http://www.example.org/foo:joy:bar> :joy:
[bar](http://www.example.org/foo:joy:)
"""
)
)
== textwrap.dedent(
"""\
<p><a href="http://www.example.org/foo:joy:bar">http://www.example.org/foo:joy:bar</a> 😂</p>
<p><a href="http://www.example.org/foo:joy:">bar</a></p>
"""
)
)