Debian Codegraph @

tests/test_syntax/inline/test_entities.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-2023 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 TestEntities(TestCase):
26
27 def test_named_entities(self):
28 self.assertMarkdownRenders("&amp;", "<p>&amp;</p>")
29 self.assertMarkdownRenders("&sup2;", "<p>&sup2;</p>")
30 self.assertMarkdownRenders("&Aacute;", "<p>&Aacute;</p>")
31
32 def test_decimal_entities(self):
33 self.assertMarkdownRenders("&#38;", "<p>&#38;</p>")
34 self.assertMarkdownRenders("&#178;", "<p>&#178;</p>")
35
36 def test_hexadecimal_entities(self):
37 self.assertMarkdownRenders("&#x00026;", "<p>&#x00026;</p>")
38 self.assertMarkdownRenders("&#xB2;", "<p>&#xB2;</p>")
39
40 def test_false_entities(self):
41 self.assertMarkdownRenders("&not an entity;", "<p>&amp;not an entity;</p>")
42 self.assertMarkdownRenders("&#B2;", "<p>&amp;#B2;</p>")
43 self.assertMarkdownRenders("&#xnothex;", "<p>&amp;#xnothex;</p>")