Debian Codegraph @

tests/test_syntax/extensions/test_legacy_em.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 TestLegacyEm(TestCase):
26 def test_legacy_emphasis(self):
27 self.assertMarkdownRenders(
28 '_connected_words_',
29 '<p><em>connected</em>words_</p>',
30 extensions=['legacy_em']
31 )
32
33 def test_legacy_strong(self):
34 self.assertMarkdownRenders(
35 '__connected__words__',
36 '<p><strong>connected</strong>words__</p>',
37 extensions=['legacy_em']
38 )
39
40 def test_complex_emphasis_underscore(self):
41 self.assertMarkdownRenders(
42 'This is text __bold _italic bold___ with more text',
43 '<p>This is text <strong>bold <em>italic bold</em></strong> with more text</p>',
44 extensions=['legacy_em']
45 )
46
47 def test_complex_emphasis_underscore_mid_word(self):
48 self.assertMarkdownRenders(
49 'This is text __bold_italic bold___ with more text',
50 '<p>This is text <strong>bold<em>italic bold</em></strong> with more text</p>',
51 extensions=['legacy_em']
52 )
53
54 def test_complex_multple_underscore_type(self):
55
56 self.assertMarkdownRenders(
57 'traced ___along___ bla __blocked__ if other ___or___',
58 '<p>traced <strong><em>along</em></strong> bla <strong>blocked</strong> if other <strong><em>or</em></strong></p>' # noqa: E501
59 )
60
61 def test_complex_multple_underscore_type_variant2(self):
62
63 self.assertMarkdownRenders(
64 'on the __1-4 row__ of the AP Combat Table ___and___ receive',
65 '<p>on the <strong>1-4 row</strong> of the AP Combat Table <strong><em>and</em></strong> receive</p>'
66 )