Debian Codegraph @

tests/test_syntax/inline/test_code.py

raw
1 """
2 Python Markdown
3
4 A Python implementation of John Gruber's Markdown.
5
6 Documentation: https://python-markdown.github.io/
7 GitHub: https://github.com/Python-Markdown/markdown/
8 PyPI: https://pypi.org/project/Markdown/
9
10 Started by Manfred Stienstra (http://www.dwerg.net/).
11 Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
12 Currently maintained by Waylan Limberg (https://github.com/waylan),
13 Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).
14
15 Copyright 2007-2019 The Python Markdown Project (v. 1.7 and later)
16 Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
17 Copyright 2004 Manfred Stienstra (the original version)
18
19 License: BSD (see LICENSE.md for details).
20 """
21
22 from markdown.test_tools import TestCase
23
24
25 class TestCode(TestCase):
26
27 def test_code_comments(self):
28 self.assertMarkdownRenders(
29 self.dedent(
30 """
31 Some code `<!--` that is not HTML `-->` in a paragraph.
32
33 Some code `<!--`
34 that is not HTML `-->`
35 in a paragraph.
36 """
37 ),
38 self.dedent(
39 """
40 <p>Some code <code>&lt;!--</code> that is not HTML <code>--&gt;</code> in a paragraph.</p>
41 <p>Some code <code>&lt;!--</code>
42 that is not HTML <code>--&gt;</code>
43 in a paragraph.</p>
44 """
45 )
46 )
47
48 def test_code_html(self):
49 self.assertMarkdownRenders(
50 self.dedent(
51 """
52 <p>html</p>
53
54 Paragraph with code: `<p>test</p>`.
55 """
56 ),
57 self.dedent(
58 """
59 <p>html</p>
60
61 <p>Paragraph with code: <code>&lt;p&gt;test&lt;/p&gt;</code>.</p>
62 """
63 )
64 )
65
66 def test_noname_tag(self):
67 # Browsers ignore `</>`, but a Markdown parser should not, and should treat it as data
68 # but not a tag.
69
70 self.assertMarkdownRenders(
71 self.dedent(
72 """
73 `</>`
74 """
75 ),
76 self.dedent(
77 """
78 <p><code>&lt;/&gt;</code></p>
79 """
80 )
81 )