• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Python Markdown
3
4A Python implementation of John Gruber's Markdown.
5
6Documentation: https://python-markdown.github.io/
7GitHub: https://github.com/Python-Markdown/markdown/
8PyPI: https://pypi.org/project/Markdown/
9
10Started by Manfred Stienstra (http://www.dwerg.net/).
11Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
12Currently maintained by Waylan Limberg (https://github.com/waylan),
13Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).
14
15Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later)
16Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
17Copyright 2004 Manfred Stienstra (the original version)
18
19License: BSD (see LICENSE.md for details).
20"""
21
22from markdown.test_tools import TestCase
23
24
25class 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>")
44