aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2014-11-20 20:36:22 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2014-11-20 20:36:22 -0500
commitb206ec0d03e3d28d810f20dfeffb48b962731c69 (patch)
treeb3f079a60ef2eaf5b73ff7e44d2d1eca252926e2 /tests
parent8f66a94eab1389d97041944ed24afd2bf7c4389c (diff)
downloadmarkdown-b206ec0d03e3d28d810f20dfeffb48b962731c69.tar.gz
markdown-b206ec0d03e3d28d810f20dfeffb48b962731c69.tar.bz2
markdown-b206ec0d03e3d28d810f20dfeffb48b962731c69.zip
Completed flake8 cleanup.
I've decided to go with longer lines in the tests. Also fixed a couple errors with the previous cleanup.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_apis.py304
-rw-r--r--tests/test_extensions.py435
2 files changed, 480 insertions, 259 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py
index f89dba9..769ac83 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -21,6 +21,7 @@ import tempfile
PY3 = sys.version_info[0] == 3
+
class TestMarkdownBasics(unittest.TestCase):
""" Tests basics of the Markdown class. """
@@ -53,6 +54,7 @@ class TestMarkdownBasics(unittest.TestCase):
""" Test Extension loading with class name (`path.to.module:Class`). """
markdown.Markdown(extensions=['markdown.extensions.footnotes:FootnoteExtension'])
+
class TestBlockParser(unittest.TestCase):
""" Tests of the BlockParser class. """
@@ -65,8 +67,10 @@ class TestBlockParser(unittest.TestCase):
root = markdown.util.etree.Element("div")
text = 'foo'
self.parser.parseChunk(root, text)
- self.assertEqual(markdown.serializers.to_xhtml_string(root),
- "<div><p>foo</p></div>")
+ self.assertEqual(
+ markdown.serializers.to_xhtml_string(root),
+ "<div><p>foo</p></div>"
+ )
def testParseDocument(self):
""" Test BlockParser.parseDocument. """
@@ -74,8 +78,10 @@ class TestBlockParser(unittest.TestCase):
tree = self.parser.parseDocument(lines)
self.assertTrue(isinstance(tree, markdown.util.etree.ElementTree))
self.assertTrue(markdown.util.etree.iselement(tree.getroot()))
- self.assertEqual(markdown.serializers.to_xhtml_string(tree.getroot()),
- "<div><h1>foo</h1><p>bar</p><pre><code>baz\n</code></pre></div>")
+ self.assertEqual(
+ markdown.serializers.to_xhtml_string(tree.getroot()),
+ "<div><h1>foo</h1><p>bar</p><pre><code>baz\n</code></pre></div>"
+ )
class TestBlockParserState(unittest.TestCase):
@@ -115,9 +121,10 @@ class TestBlockParserState(unittest.TestCase):
self.state.reset()
self.assertEqual(self.state, ['state1'])
+
class TestHtmlStash(unittest.TestCase):
""" Test Markdown's HtmlStash. """
-
+
def setUp(self):
self.stash = markdown.util.HtmlStash()
self.placeholder = self.stash.store('foo')
@@ -133,14 +140,18 @@ class TestHtmlStash(unittest.TestCase):
placeholder = self.stash.store('bar')
self.assertEqual(placeholder, self.stash.get_placeholder(1))
self.assertEqual(self.stash.html_counter, 2)
- self.assertEqual(self.stash.rawHtmlBlocks,
- [('foo', False), ('bar', False)])
+ self.assertEqual(
+ self.stash.rawHtmlBlocks,
+ [('foo', False), ('bar', False)]
+ )
def testSafeStore(self):
""" Test HtmlStash.store with 'safe' html. """
self.stash.store('bar', True)
- self.assertEqual(self.stash.rawHtmlBlocks,
- [('foo', False), ('bar', True)])
+ self.assertEqual(
+ self.stash.rawHtmlBlocks,
+ [('foo', False), ('bar', True)]
+ )
def testReset(self):
""" Test HtmlStash.reset. """
@@ -184,49 +195,86 @@ class TestOrderedDict(unittest.TestCase):
def testKeys(self):
""" Test output of OrderedDict.keys(). """
- self.assertEqual(list(self.odict.keys()),
- ['first', 'third', 'fourth', 'fifth'])
+ self.assertEqual(
+ list(self.odict.keys()),
+ ['first', 'third', 'fourth', 'fifth']
+ )
def testItems(self):
""" Test output of OrderedDict.items(). """
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('third', 'a'),
- ('fourth', 'self'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('third', 'a'),
+ ('fourth', 'self'),
+ ('fifth', 'test')
+ ]
+ )
def testAddBefore(self):
""" Test adding an OrderedDict item before a given key. """
self.odict.add('second', 'is', '<third')
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('second', 'is'), ('third', 'a'),
- ('fourth', 'self'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('second', 'is'),
+ ('third', 'a'),
+ ('fourth', 'self'),
+ ('fifth', 'test')
+ ]
+ )
def testAddAfter(self):
""" Test adding an OrderDict item after a given key. """
self.odict.add('second', 'is', '>first')
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('second', 'is'), ('third', 'a'),
- ('fourth', 'self'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('second', 'is'),
+ ('third', 'a'),
+ ('fourth', 'self'),
+ ('fifth', 'test')
+ ]
+ )
def testAddAfterEnd(self):
""" Test adding an OrderedDict item after the last key. """
self.odict.add('sixth', '.', '>fifth')
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('third', 'a'),
- ('fourth', 'self'), ('fifth', 'test'), ('sixth', '.')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('third', 'a'),
+ ('fourth', 'self'),
+ ('fifth', 'test'),
+ ('sixth', '.')
+ ]
+ )
def testAdd_begin(self):
""" Test adding an OrderedDict item using "_begin". """
self.odict.add('zero', 'CRAZY', '_begin')
- self.assertEqual(list(self.odict.items()),
- [('zero', 'CRAZY'), ('first', 'This'), ('third', 'a'),
- ('fourth', 'self'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('zero', 'CRAZY'),
+ ('first', 'This'),
+ ('third', 'a'),
+ ('fourth', 'self'),
+ ('fifth', 'test')
+ ]
+ )
def testAdd_end(self):
""" Test adding an OrderedDict item using "_end". """
self.odict.add('sixth', '.', '_end')
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('third', 'a'),
- ('fourth', 'self'), ('fifth', 'test'), ('sixth', '.')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('third', 'a'),
+ ('fourth', 'self'),
+ ('fifth', 'test'),
+ ('sixth', '.')
+ ]
+ )
def testAddBadLocation(self):
""" Test Error on bad location in OrderedDict.add(). """
@@ -236,30 +284,48 @@ class TestOrderedDict(unittest.TestCase):
def testDeleteItem(self):
""" Test deletion of an OrderedDict item. """
del self.odict['fourth']
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('third', 'a'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()),
+ [('first', 'This'), ('third', 'a'), ('fifth', 'test')]
+ )
def testChangeValue(self):
""" Test OrderedDict change value. """
self.odict['fourth'] = 'CRAZY'
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('third', 'a'),
- ('fourth', 'CRAZY'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('third', 'a'),
+ ('fourth', 'CRAZY'),
+ ('fifth', 'test')
+ ]
+ )
def testChangeOrder(self):
""" Test OrderedDict change order. """
self.odict.link('fourth', '<third')
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('fourth', 'self'),
- ('third', 'a'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('fourth', 'self'),
+ ('third', 'a'),
+ ('fifth', 'test')
+ ]
+ )
def textBadLink(self):
""" Test OrderedDict change order with bad location. """
self.assertRaises(ValueError, self.odict.link('fourth', '<bad'))
# Check for data integrity ("fourth" wasn't deleted).'
- self.assertEqual(list(self.odict.items()),
- [('first', 'This'), ('third', 'a'),
- ('fourth', 'self'), ('fifth', 'test')])
+ self.assertEqual(
+ list(self.odict.items()), [
+ ('first', 'This'),
+ ('third', 'a'),
+ ('fourth', 'self'),
+ ('fifth', 'test')
+ ]
+ )
+
class TestErrors(unittest.TestCase):
""" Test Error Reporting. """
@@ -275,7 +341,7 @@ class TestErrors(unittest.TestCase):
def testNonUnicodeSource(self):
""" Test falure on non-unicode source text. """
if sys.version_info < (3, 0):
- source = "foo".encode('utf-16')
+ source = "foo".encode('utf-16')
self.assertRaises(UnicodeDecodeError, markdown.markdown, source)
def testBadOutputFormat(self):
@@ -284,8 +350,10 @@ class TestErrors(unittest.TestCase):
def testLoadExtensionFailure(self):
""" Test failure of an extension to load. """
- self.assertRaises(ImportError,
- markdown.Markdown, extensions=['non_existant_ext'])
+ self.assertRaises(
+ ImportError,
+ markdown.Markdown, extensions=['non_existant_ext']
+ )
def testLoadBadExtension(self):
""" Test loading of an Extension with no makeExtension function. """
@@ -297,24 +365,32 @@ class TestErrors(unittest.TestCase):
def testBaseExtention(self):
""" Test that the base Extension class will raise NotImplemented. """
- self.assertRaises(NotImplementedError,
- markdown.Markdown, extensions=[markdown.extensions.Extension()])
+ self.assertRaises(
+ NotImplementedError,
+ markdown.Markdown, extensions=[markdown.extensions.Extension()]
+ )
def testMdxExtention(self):
""" Test that appending mdx_ raises a PendingDeprecationWarning. """
_create_fake_extension(name='fake', use_old_style=True)
- self.assertRaises(PendingDeprecationWarning,
- markdown.Markdown, extensions=['fake'])
+ self.assertRaises(
+ PendingDeprecationWarning,
+ markdown.Markdown, extensions=['fake']
+ )
def testShortNameExtention(self):
""" Test that using a short name raises a PendingDeprecationWarning. """
- self.assertRaises(PendingDeprecationWarning,
- markdown.Markdown, extensions=['footnotes'])
+ self.assertRaises(
+ PendingDeprecationWarning,
+ markdown.Markdown, extensions=['footnotes']
+ )
def testStringConfigExtention(self):
""" Test that passing configs to an Extension in the name raises a PendingDeprecationWarning. """
- self.assertRaises(PendingDeprecationWarning,
- markdown.Markdown, extensions=['markdown.extension.footnotes(PLACE_MARKER=FOO)'])
+ self.assertRaises(
+ PendingDeprecationWarning,
+ markdown.Markdown, extensions=['markdown.extension.footnotes(PLACE_MARKER=FOO)']
+ )
def _create_fake_extension(name, has_factory_func=True, is_wrong_type=False, use_old_style=False):
@@ -327,21 +403,23 @@ def _create_fake_extension(name, has_factory_func=True, is_wrong_type=False, use
# mod_name must be bytes in Python 2.x
mod_name = bytes(mod_name)
ext_mod = types.ModuleType(mod_name)
+
def makeExtension(*args, **kwargs):
if is_wrong_type:
return object
else:
return markdown.extensions.Extension(*args, **kwargs)
+
if has_factory_func:
ext_mod.makeExtension = makeExtension
- # Warning: this brute forces the extenson module onto the system. Either
- # this needs to be specificly overriden or a new python session needs to
+ # Warning: this brute forces the extenson module onto the system. Either
+ # this needs to be specificly overriden or a new python session needs to
# be started to get rid of this. This should be ok in a testing context.
- sys.modules[mod_name] = ext_mod
+ sys.modules[mod_name] = ext_mod
class testETreeComments(unittest.TestCase):
- """
+ """
Test that ElementTree Comments work.
These tests should only be a concern when using cElementTree with third
@@ -369,15 +447,19 @@ class testETreeComments(unittest.TestCase):
def testCommentSerialization(self):
""" Test that an ElementTree Comment serializes properly. """
- self.assertEqual(markdown.serializers.to_html_string(self.comment),
- '<!--foo-->')
+ self.assertEqual(
+ markdown.serializers.to_html_string(self.comment),
+ '<!--foo-->'
+ )
def testCommentPrettify(self):
""" Test that an ElementTree Comment is prettified properly. """
pretty = markdown.treeprocessors.PrettifyTreeprocessor()
pretty.run(self.comment)
- self.assertEqual(markdown.serializers.to_html_string(self.comment),
- '<!--foo-->\n')
+ self.assertEqual(
+ markdown.serializers.to_html_string(self.comment),
+ '<!--foo-->\n'
+ )
class testElementTailTests(unittest.TestCase):
@@ -402,18 +484,22 @@ class testSerializers(unittest.TestCase):
el = markdown.util.etree.Element('div')
p = markdown.util.etree.SubElement(el, 'p')
p.text = 'foo'
- hr = markdown.util.etree.SubElement(el, 'hr')
- self.assertEqual(markdown.serializers.to_html_string(el),
- '<div><p>foo</p><hr></div>')
+ markdown.util.etree.SubElement(el, 'hr')
+ self.assertEqual(
+ markdown.serializers.to_html_string(el),
+ '<div><p>foo</p><hr></div>'
+ )
def testXhtml(self):
"""" Test XHTML serialization. """
el = markdown.util.etree.Element('div')
p = markdown.util.etree.SubElement(el, 'p')
p.text = 'foo'
- hr = markdown.util.etree.SubElement(el, 'hr')
- self.assertEqual(markdown.serializers.to_xhtml_string(el),
- '<div><p>foo</p><hr /></div>')
+ markdown.util.etree.SubElement(el, 'hr')
+ self.assertEqual(
+ markdown.serializers.to_xhtml_string(el),
+ '<div><p>foo</p><hr /></div>'
+ )
def testMixedCaseTags(self):
"""" Test preservation of tag case. """
@@ -421,10 +507,11 @@ class testSerializers(unittest.TestCase):
el.text = 'not valid '
em = markdown.util.etree.SubElement(el, 'EMPHASIS')
em.text = 'html'
- hr = markdown.util.etree.SubElement(el, 'HR')
- self.assertEqual(markdown.serializers.to_xhtml_string(el),
- '<MixedCase>not valid <EMPHASIS>html</EMPHASIS><HR /></MixedCase>')
-
+ markdown.util.etree.SubElement(el, 'HR')
+ self.assertEqual(
+ markdown.serializers.to_xhtml_string(el),
+ '<MixedCase>not valid <EMPHASIS>html</EMPHASIS><HR /></MixedCase>'
+ )
def buildExtension(self):
""" Build an extension which registers fakeSerializer. """
@@ -439,9 +526,12 @@ class testSerializers(unittest.TestCase):
return registerFakeSerializer()
def testRegisterSerializer(self):
- self.assertEqual(markdown.markdown('baz',
- extensions=[self.buildExtension()], output_format='fake'),
- '<p>foo</p>')
+ self.assertEqual(
+ markdown.markdown(
+ 'baz', extensions=[self.buildExtension()], output_format='fake'
+ ),
+ '<p>foo</p>'
+ )
class testAtomicString(unittest.TestCase):
@@ -457,8 +547,10 @@ class testAtomicString(unittest.TestCase):
p = markdown.util.etree.SubElement(tree, 'p')
p.text = 'some *text*'
new = self.inlineprocessor.run(tree)
- self.assertEqual(markdown.serializers.to_html_string(new),
- '<div><p>some <em>text</em></p></div>')
+ self.assertEqual(
+ markdown.serializers.to_html_string(new),
+ '<div><p>some <em>text</em></p></div>'
+ )
def testSimpleAtomicString(self):
""" Test that a simple AtomicString is not parsed. """
@@ -466,8 +558,10 @@ class testAtomicString(unittest.TestCase):
p = markdown.util.etree.SubElement(tree, 'p')
p.text = markdown.util.AtomicString('some *text*')
new = self.inlineprocessor.run(tree)
- self.assertEqual(markdown.serializers.to_html_string(new),
- '<div><p>some *text*</p></div>')
+ self.assertEqual(
+ markdown.serializers.to_html_string(new),
+ '<div><p>some *text*</p></div>'
+ )
def testNestedAtomicString(self):
""" Test that a nested AtomicString is not parsed. """
@@ -484,9 +578,12 @@ class testAtomicString(unittest.TestCase):
span2.tail = markdown.util.AtomicString(' *test*')
span1.tail = markdown.util.AtomicString(' *with*')
new = self.inlineprocessor.run(tree)
- self.assertEqual(markdown.serializers.to_html_string(new),
+ self.assertEqual(
+ markdown.serializers.to_html_string(new),
'<div><p>*some* <span>*more* <span>*text* <span>*here*</span> '
- '*to*</span> *test*</span> *with*</p></div>')
+ '*to*</span> *test*</span> *with*</p></div>'
+ )
+
class TestConfigParsing(unittest.TestCase):
def assertParses(self, value, result):
@@ -507,6 +604,7 @@ class TestConfigParsing(unittest.TestCase):
def testInvalidBooleansParsing(self):
self.assertRaises(ValueError, markdown.util.parseBoolValue, 'novalue')
+
class TestCliOptionParsing(unittest.TestCase):
""" Test parsing of Command Line Interface Options. """
@@ -519,7 +617,7 @@ class TestCliOptionParsing(unittest.TestCase):
'output_format': 'xhtml1',
'lazy_ol': True,
'extensions': [],
- 'extension_configs': {},
+ 'extension_configs': {},
}
self.tempfile = ''
@@ -531,7 +629,7 @@ class TestCliOptionParsing(unittest.TestCase):
options, logging_level = parse_options([])
self.assertEqual(options, self.default_options)
self.assertEqual(logging_level, CRITICAL)
-
+
def testQuietOption(self):
options, logging_level = parse_options(['-q'])
self.assertTrue(logging_level > CRITICAL)
@@ -586,10 +684,14 @@ class TestCliOptionParsing(unittest.TestCase):
self.assertEqual(options, self.default_options)
def testMultipleExtensionOptions(self):
- options, logging_level = parse_options(['-x', 'markdown.extensions.footnotes',
- '-x', 'markdown.extensions.smarty'])
- self.default_options['extensions'] = ['markdown.extensions.footnotes',
- 'markdown.extensions.smarty']
+ options, logging_level = parse_options([
+ '-x', 'markdown.extensions.footnotes',
+ '-x', 'markdown.extensions.smarty'
+ ])
+ self.default_options['extensions'] = [
+ 'markdown.extensions.footnotes',
+ 'markdown.extensions.smarty'
+ ]
self.assertEqual(options, self.default_options)
def create_config_file(self, config):
@@ -603,13 +705,13 @@ class TestCliOptionParsing(unittest.TestCase):
def testExtensionConfigOption(self):
config = {
- 'markdown.extensions.wikilinks': {
- 'base_url': 'http://example.com/',
- 'end_url': '.html',
- 'html_class': 'test',
+ 'markdown.extensions.wikilinks': {
+ 'base_url': 'http://example.com/',
+ 'end_url': '.html',
+ 'html_class': 'test',
},
- 'markdown.extensions.footnotes:FootnotesExtension': {
- 'PLACE_MARKER': '~~~footnotes~~~'
+ 'markdown.extensions.footnotes:FootnotesExtension': {
+ 'PLACE_MARKER': '~~~footnotes~~~'
}
}
self.create_config_file(config)
@@ -619,10 +721,10 @@ class TestCliOptionParsing(unittest.TestCase):
def textBoolExtensionConfigOption(self):
config = {
- 'markdown.extensions.toc': {
- 'title': 'Some Title',
- 'anchorlink': True,
- 'permalink': True
+ 'markdown.extensions.toc': {
+ 'title': 'Some Title',
+ 'anchorlink': True,
+ 'permalink': True
}
}
self.create_config_file(config)
@@ -632,13 +734,13 @@ class TestCliOptionParsing(unittest.TestCase):
def testExtensonConfigOptionAsJSON(self):
config = {
- 'markdown.extensions.wikilinks': {
- 'base_url': 'http://example.com/',
- 'end_url': '.html',
- 'html_class': 'test',
+ 'markdown.extensions.wikilinks': {
+ 'base_url': 'http://example.com/',
+ 'end_url': '.html',
+ 'html_class': 'test',
},
- 'markdown.extensions.footnotes:FootnotesExtension': {
- 'PLACE_MARKER': '~~~footnotes~~~'
+ 'markdown.extensions.footnotes:FootnotesExtension': {
+ 'PLACE_MARKER': '~~~footnotes~~~'
}
}
import json
@@ -652,7 +754,7 @@ class TestCliOptionParsing(unittest.TestCase):
def testExtensonConfigOptionBadFormat(self):
config = """
-[footnotes]
+[footnotes]
PLACE_MARKER= ~~~footnotes~~~
"""
self.create_config_file(config)
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index efd9524..a037915 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -11,6 +11,7 @@ from __future__ import unicode_literals
import unittest
import markdown
+
class TestExtensionClass(unittest.TestCase):
""" Test markdown.extensions.Extension. """
@@ -35,9 +36,13 @@ class TestExtensionClass(unittest.TestCase):
self.assertEqual(self.ext.getConfigs(), {'foo': 'bar', 'bar': 'baz'})
def testGetConfigInfo(self):
- self.assertEqual(dict(self.ext.getConfigInfo()),
- dict([('foo', 'Description of foo'),
- ('bar', 'Description of bar')]))
+ self.assertEqual(
+ dict(self.ext.getConfigInfo()),
+ dict([
+ ('foo', 'Description of foo'),
+ ('bar', 'Description of bar')
+ ])
+ )
def testSetConfig(self):
self.ext.setConfig('foo', 'baz')
@@ -63,18 +68,22 @@ class TestAbbr(unittest.TestCase):
text = 'Some text with an ABBR and a REF. Ignore REFERENCE and ref.' + \
'\n\n*[ABBR]: Abbreviation\n' + \
'*[REF]: Abbreviation Reference'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<p>Some text with an <abbr title="Abbreviation">ABBR</abbr> '
'and a <abbr title="Abbreviation Reference">REF</abbr>. Ignore '
- 'REFERENCE and ref.</p>')
+ 'REFERENCE and ref.</p>'
+ )
def testNestedAbbr(self):
""" Test Nested Abbreviations. """
text = '[ABBR](/foo) and _ABBR_\n\n' + \
'*[ABBR]: Abreviation'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<p><a href="/foo"><abbr title="Abreviation">ABBR</abbr></a> '
- 'and <em><abbr title="Abreviation">ABBR</abbr></em></p>')
+ 'and <em><abbr title="Abreviation">ABBR</abbr></em></p>'
+ )
class TestCodeHilite(unittest.TestCase):
@@ -83,7 +92,7 @@ class TestCodeHilite(unittest.TestCase):
def setUp(self):
self.has_pygments = True
try:
- import pygments
+ import pygments # noqa
except ImportError:
self.has_pygments = False
@@ -94,38 +103,49 @@ class TestCodeHilite(unittest.TestCase):
# Pygments can use random lexer here as we did not specify the language
self.assertTrue(md.convert(text).startswith('<div class="codehilite"><pre>'))
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code># A Code Comment'
- '</code></pre>')
-
+ '</code></pre>'
+ )
+
def testLinenumsTrue(self):
text = '\t# A Code Comment'
md = markdown.Markdown(
extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=True)])
if self.has_pygments:
# Different versions of pygments output slightly different markup.
- # So we use 'startwith' and test just enough to confirm that
+ # So we use 'startwith' and test just enough to confirm that
# pygments received and processed linenums.
- self.assertTrue(md.convert(text).startswith(
- '<table class="codehilitetable"><tr><td class="linenos">'))
+ self.assertTrue(
+ md.convert(text).startswith(
+ '<table class="codehilitetable"><tr><td class="linenos">'
+ )
+ )
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code class="linenums"># A Code Comment'
- '</code></pre>')
+ '</code></pre>'
+ )
def testLinenumsFalse(self):
text = '\t#!Python\n\t# A Code Comment'
md = markdown.Markdown(
extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=False)])
if self.has_pygments:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<div class="codehilite">'
'<pre><span class="c"># A Code Comment</span>\n'
- '</pre></div>')
+ '</pre></div>'
+ )
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code class="language-python"># A Code Comment'
- '</code></pre>')
+ '</code></pre>'
+ )
def testLinenumsNone(self):
text = '\t# A Code Comment'
@@ -135,9 +155,11 @@ class TestCodeHilite(unittest.TestCase):
# Pygments can use random lexer here as we did not specify the language
self.assertTrue(md.convert(text).startswith('<div class="codehilite"><pre>'))
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code># A Code Comment'
- '</code></pre>')
+ '</code></pre>'
+ )
def testLinenumsNoneWithShebang(self):
text = '\t#!Python\n\t# A Code Comment'
@@ -145,28 +167,38 @@ class TestCodeHilite(unittest.TestCase):
extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=None)])
if self.has_pygments:
# Differant versions of pygments output slightly different markup.
- # So we use 'startwith' and test just enough to confirm that
+ # So we use 'startwith' and test just enough to confirm that
# pygments received and processed linenums.
- self.assertTrue(md.convert(text).startswith(
- '<table class="codehilitetable"><tr><td class="linenos">'))
+ self.assertTrue(
+ md.convert(text).startswith(
+ '<table class="codehilitetable"><tr><td class="linenos">'
+ )
+ )
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code class="language-python linenums"># A Code Comment'
- '</code></pre>')
+ '</code></pre>'
+ )
def testLinenumsNoneWithColon(self):
text = '\t:::Python\n\t# A Code Comment'
md = markdown.Markdown(
- extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=None)])
+ extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=None)]
+ )
if self.has_pygments:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<div class="codehilite">'
'<pre><span class="c"># A Code Comment</span>\n'
- '</pre></div>')
+ '</pre></div>'
+ )
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code class="language-python"># A Code Comment'
- '</code></pre>')
+ '</code></pre>'
+ )
def testHighlightLinesWithColon(self):
# Test with hl_lines delimited by single or double quotes.
@@ -176,18 +208,23 @@ class TestCodeHilite(unittest.TestCase):
for text in (text0, text1):
md = markdown.Markdown(extensions=['markdown.extensions.codehilite'])
if self.has_pygments:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<div class="codehilite"><pre>'
'<span class="c">#line 1</span>\n'
'<span class="hll"><span class="c">#line 2</span>\n</span>'
'<span class="c">#line 3</span>\n'
- '</pre></div>')
+ '</pre></div>'
+ )
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite">'
'<code class="language-python">#line 1\n'
'#line 2\n'
- '#line 3</code></pre>')
+ '#line 3</code></pre>'
+ )
+
class TestFencedCode(unittest.TestCase):
""" Test fenced_code extension. """
@@ -196,7 +233,7 @@ class TestFencedCode(unittest.TestCase):
self.md = markdown.Markdown(extensions=['markdown.extensions.fenced_code'])
self.has_pygments = True
try:
- import pygments
+ import pygments # noqa
except ImportError:
self.has_pygments = False
@@ -208,18 +245,22 @@ A paragraph before a fenced code block:
~~~
Fenced code block
~~~'''
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<p>A paragraph before a fenced code block:</p>\n'
'<pre><code>Fenced code block\n'
- '</code></pre>')
+ '</code></pre>'
+ )
def testSafeFence(self):
""" Test Fenced Code with safe_mode. """
text = '~~~\nCode\n~~~'
self.md.safeMode = 'replace'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<pre><code>Code\n'
- '</code></pre>')
+ '</code></pre>'
+ )
def testNestedFence(self):
""" Test nested fence. """
@@ -229,10 +270,12 @@ Fenced code block
~~~~
~~~~~~~~'''
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<pre><code>\n'
'~~~~\n'
- '</code></pre>')
+ '</code></pre>'
+ )
def testFencedLanguage(self):
""" Test Language Tags. """
@@ -241,9 +284,11 @@ Fenced code block
~~~~{.python}
# Some python code
~~~~'''
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<pre><code class="python"># Some python code\n'
- '</code></pre>')
+ '</code></pre>'
+ )
def testFencedBackticks(self):
""" Test Code Fenced with Backticks. """
@@ -253,10 +298,12 @@ Fenced code block
# Arbitrary code
~~~~~ # these tildes will not close the block
`````'''
- self.assertEqual(self.md.convert(text),
- '<pre><code># Arbitrary code\n'
- '~~~~~ # these tildes will not close the block\n'
- '</code></pre>')
+ self.assertEqual(
+ self.md.convert(text),
+ '<pre><code># Arbitrary code\n'
+ '~~~~~ # these tildes will not close the block\n'
+ '</code></pre>'
+ )
def testFencedCodeWithHighlightLines(self):
""" Test Fenced Code with Highlighted Lines. """
@@ -267,22 +314,29 @@ line 1
line 2
line 3
```'''
- md = markdown.Markdown(extensions=[
- markdown.extensions.codehilite.CodeHiliteExtension(linenums=None, guess_lang=False),
- 'markdown.extensions.fenced_code'])
+ md = markdown.Markdown(
+ extensions=[
+ markdown.extensions.codehilite.CodeHiliteExtension(linenums=None, guess_lang=False),
+ 'markdown.extensions.fenced_code'
+ ]
+ )
if self.has_pygments:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<div class="codehilite"><pre>'
'<span class="hll">line 1\n</span>'
'line 2\n'
'<span class="hll">line 3\n</span>'
- '</pre></div>')
+ '</pre></div>'
+ )
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code>line 1\n'
'line 2\n'
- 'line 3</code></pre>')
+ 'line 3</code></pre>'
+ )
def testFencedLanguageAndHighlightLines(self):
""" Test Fenced Code with Highlighted Lines. """
@@ -300,22 +354,29 @@ line 3
#line 3
~~~'''
for text in (text0, text1):
- md = markdown.Markdown(extensions=[
- markdown.extensions.codehilite.CodeHiliteExtension(linenums=None, guess_lang=False),
- 'markdown.extensions.fenced_code'])
-
+ md = markdown.Markdown(
+ extensions=[
+ markdown.extensions.codehilite.CodeHiliteExtension(linenums=None, guess_lang=False),
+ 'markdown.extensions.fenced_code'
+ ]
+ )
if self.has_pygments:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<div class="codehilite"><pre>'
'<span class="hll"><span class="c">#line 1</span>\n</span>'
'<span class="c">#line 2</span>\n'
'<span class="hll"><span class="c">#line 3</span>\n</span>'
- '</pre></div>')
+ '</pre></div>'
+ )
else:
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<pre class="codehilite"><code class="language-python">#line 1\n'
'#line 2\n'
- '#line 3</code></pre>')
+ '#line 3</code></pre>'
+ )
+
class TestHeaderId(unittest.TestCase):
""" Test HeaderId Extension. """
@@ -327,8 +388,10 @@ class TestHeaderId(unittest.TestCase):
""" Test Basic HeaderID """
text = "# Some Header #"
- self.assertEqual(self.md.convert(text),
- '<h1 id="some-header">Some Header</h1>')
+ self.assertEqual(
+ self.md.convert(text),
+ '<h1 id="some-header">Some Header</h1>'
+ )
def testUniqueFunc(self):
""" Test 'unique' function. """
@@ -341,10 +404,12 @@ class TestHeaderId(unittest.TestCase):
""" Test Unique IDs. """
text = '#Header\n#Header\n#Header'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<h1 id="header">Header</h1>\n'
'<h1 id="header_1">Header</h1>\n'
- '<h1 id="header_2">Header</h1>')
+ '<h1 id="header_2">Header</h1>'
+ )
def testBaseLevel(self):
""" Test Header Base Level. """
@@ -353,27 +418,34 @@ class TestHeaderId(unittest.TestCase):
self.assertEqual(
markdown.markdown(text, [markdown.extensions.headerid.HeaderIdExtension(level=3)]),
'<h3 id="some-header">Some Header</h3>\n'
- '<h4 id="next-level">Next Level</h4>')
+ '<h4 id="next-level">Next Level</h4>'
+ )
def testHeaderInlineMarkup(self):
""" Test Header IDs with inline markup. """
text = '#Some *Header* with [markup](http://example.com).'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<h1 id="some-header-with-markup">Some <em>Header</em> with '
- '<a href="http://example.com">markup</a>.</h1>')
+ '<a href="http://example.com">markup</a>.</h1>'
+ )
def testHtmlEntities(self):
""" Test HeaderIDs with HTML Entities. """
text = '# Foo &amp; bar'
- self.assertEqual(self.md.convert(text),
- '<h1 id="foo-bar">Foo &amp; bar</h1>')
+ self.assertEqual(
+ self.md.convert(text),
+ '<h1 id="foo-bar">Foo &amp; bar</h1>'
+ )
def testRawHtml(self):
""" Test HeaderIDs with raw HTML. """
text = '# Foo <b>Bar</b> Baz.'
- self.assertEqual(self.md.convert(text),
- '<h1 id="foo-bar-baz">Foo <b>Bar</b> Baz.</h1>')
+ self.assertEqual(
+ self.md.convert(text),
+ '<h1 id="foo-bar-baz">Foo <b>Bar</b> Baz.</h1>'
+ )
def testNoAutoIds(self):
""" Test HeaderIDs with no auto generated IDs. """
@@ -382,7 +454,8 @@ class TestHeaderId(unittest.TestCase):
self.assertEqual(
markdown.markdown(text, [markdown.extensions.headerid.HeaderIdExtension(forceid=False)]),
'<h1>Some Header</h1>\n'
- '<h1>Another Header</h1>')
+ '<h1>Another Header</h1>'
+ )
def testHeaderIdWithMetaData(self):
""" Test Header IDs with MetaData extension. """
@@ -391,20 +464,27 @@ class TestHeaderId(unittest.TestCase):
header_forceid: Off
# A Header'''
- self.assertEqual(markdown.markdown(text, ['markdown.extensions.headerid', 'markdown.extensions.meta']),
- '<h2>A Header</h2>')
+ self.assertEqual(
+ markdown.markdown(text, ['markdown.extensions.headerid', 'markdown.extensions.meta']),
+ '<h2>A Header</h2>'
+ )
def testHeaderIdWithAttr_List(self):
""" Test HeaderIDs with Attr_List extension. """
-
+
text = '# Header1 {: #foo }\n# Header2 {: .bar }'
- self.assertEqual(markdown.markdown(text, ['markdown.extensions.headerid', 'markdown.extensions.attr_list']),
+ self.assertEqual(
+ markdown.markdown(text, ['markdown.extensions.headerid', 'markdown.extensions.attr_list']),
'<h1 id="foo">Header1</h1>\n'
- '<h1 class="bar" id="header2">Header2</h1>')
+ '<h1 class="bar" id="header2">Header2</h1>'
+ )
# Switch order extensions are loaded - should be no change in behavior.
- self.assertEqual(markdown.markdown(text, ['markdown.extensions.attr_list', 'markdown.extensions.headerid']),
+ self.assertEqual(
+ markdown.markdown(text, ['markdown.extensions.attr_list', 'markdown.extensions.headerid']),
'<h1 id="foo">Header1</h1>\n'
- '<h1 class="bar" id="header2">Header2</h1>')
+ '<h1 class="bar" id="header2">Header2</h1>'
+ )
+
class TestMetaData(unittest.TestCase):
""" Test MetaData extension. """
@@ -421,20 +501,27 @@ Author: Waylan Limberg
Blank_Data:
The body. This is paragraph one.'''
- self.assertEqual(self.md.convert(text),
- '<p>The body. This is paragraph one.</p>')
- self.assertEqual(self.md.Meta,
- {'author': ['Waylan Limberg', 'John Doe'],
- 'blank_data': [''],
- 'title': ['A Test Doc.']})
+ self.assertEqual(
+ self.md.convert(text),
+ '<p>The body. This is paragraph one.</p>'
+ )
+ self.assertEqual(
+ self.md.Meta, {
+ 'author': ['Waylan Limberg', 'John Doe'],
+ 'blank_data': [''],
+ 'title': ['A Test Doc.']
+ }
+ )
def testMissingMetaData(self):
""" Test document without Meta Data. """
text = ' Some Code - not extra lines of meta data.'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<pre><code>Some Code - not extra lines of meta data.\n'
- '</code></pre>')
+ '</code></pre>'
+ )
self.assertEqual(self.md.Meta, {})
def testMetaDataWithoutNewline(self):
@@ -454,24 +541,34 @@ class TestWikiLinks(unittest.TestCase):
def testBasicWikilinks(self):
""" Test [[wikilinks]]. """
- self.assertEqual(self.md.convert(self.text),
+ self.assertEqual(
+ self.md.convert(self.text),
'<p>Some text with a '
- '<a class="wikilink" href="/WikiLink/">WikiLink</a>.</p>')
+ '<a class="wikilink" href="/WikiLink/">WikiLink</a>.</p>'
+ )
def testWikilinkWhitespace(self):
""" Test whitespace in wikilinks. """
- self.assertEqual(self.md.convert('[[ foo bar_baz ]]'),
- '<p><a class="wikilink" href="/foo_bar_baz/">foo bar_baz</a></p>')
- self.assertEqual(self.md.convert('foo [[ ]] bar'),
- '<p>foo bar</p>')
+ self.assertEqual(
+ self.md.convert('[[ foo bar_baz ]]'),
+ '<p><a class="wikilink" href="/foo_bar_baz/">foo bar_baz</a></p>'
+ )
+ self.assertEqual(
+ self.md.convert('foo [[ ]] bar'),
+ '<p>foo bar</p>'
+ )
def testSimpleSettings(self):
""" Test Simple Settings. """
- self.assertEqual(markdown.markdown(self.text,
- [markdown.extensions.wikilinks.WikiLinkExtension(base_url='/wiki/',
- end_url='.html',
- html_class='foo')]),
+ self.assertEqual(markdown.markdown(
+ self.text, [
+ markdown.extensions.wikilinks.WikiLinkExtension(
+ base_url='/wiki/',
+ end_url='.html',
+ html_class='foo')
+ ]
+ ),
'<p>Some text with a '
'<a class="foo" href="/wiki/WikiLink.html">WikiLink</a>.</p>')
@@ -479,15 +576,21 @@ class TestWikiLinks(unittest.TestCase):
""" Test Complex Settings. """
md = markdown.Markdown(
- extensions = ['markdown.extensions.wikilinks'],
- extension_configs = {'markdown.extensions.wikilinks': [
- ('base_url', 'http://example.com/'),
- ('end_url', '.html'),
- ('html_class', '') ]},
- safe_mode = True)
- self.assertEqual(md.convert(self.text),
+ extensions=['markdown.extensions.wikilinks'],
+ extension_configs={
+ 'markdown.extensions.wikilinks': [
+ ('base_url', 'http://example.com/'),
+ ('end_url', '.html'),
+ ('html_class', '')
+ ]
+ },
+ safe_mode=True
+ )
+ self.assertEqual(
+ md.convert(self.text),
'<p>Some text with a '
- '<a href="http://example.com/WikiLink.html">WikiLink</a>.</p>')
+ '<a href="http://example.com/WikiLink.html">WikiLink</a>.</p>'
+ )
def testWikilinksMetaData(self):
""" test MetaData with Wikilinks Extension. """
@@ -498,25 +601,33 @@ wiki_html_class:
Some text with a [[WikiLink]]."""
md = markdown.Markdown(extensions=['markdown.extensions.meta', 'markdown.extensions.wikilinks'])
- self.assertEqual(md.convert(text),
+ self.assertEqual(
+ md.convert(text),
'<p>Some text with a '
- '<a href="http://example.com/WikiLink.html">WikiLink</a>.</p>')
+ '<a href="http://example.com/WikiLink.html">WikiLink</a>.</p>'
+ )
# MetaData should not carry over to next document:
- self.assertEqual(md.convert("No [[MetaData]] here."),
+ self.assertEqual(
+ md.convert("No [[MetaData]] here."),
'<p>No <a class="wikilink" href="/MetaData/">MetaData</a> '
- 'here.</p>')
+ 'here.</p>'
+ )
def testURLCallback(self):
""" Test used of a custom URL builder. """
-
+
from markdown.extensions.wikilinks import WikiLinkExtension
def my_url_builder(label, base, end):
return '/bar/'
+
md = markdown.Markdown(extensions=[WikiLinkExtension(build_url=my_url_builder)])
- self.assertEqual(md.convert('[[foo]]'),
- '<p><a class="wikilink" href="/bar/">foo</a></p>')
+ self.assertEqual(
+ md.convert('[[foo]]'),
+ '<p><a class="wikilink" href="/bar/">foo</a></p>'
+ )
+
class TestAdmonition(unittest.TestCase):
""" Test Admonition Extension. """
@@ -534,74 +645,82 @@ class TestAdmonition(unittest.TestCase):
for test, expected in tests:
self.assertEqual(RE.match(test).groups(), expected)
+
class TestTOC(unittest.TestCase):
""" Test TOC Extension. """
-
+
def setUp(self):
self.md = markdown.Markdown(extensions=['markdown.extensions.toc'])
def testMarker(self):
""" Test TOC with a Marker. """
text = '[TOC]\n\n# Header 1\n\n## Header 2'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<div class="toc">\n'
- '<ul>\n'
- '<li><a href="#header-1">Header 1</a>'
- '<ul>\n'
- '<li><a href="#header-2">Header 2</a></li>\n'
- '</ul>\n'
- '</li>\n'
- '</ul>\n'
+ '<ul>\n' # noqa
+ '<li><a href="#header-1">Header 1</a>' # noqa
+ '<ul>\n' # noqa
+ '<li><a href="#header-2">Header 2</a></li>\n' # noqa
+ '</ul>\n' # noqa
+ '</li>\n' # noqa
+ '</ul>\n' # noqa
'</div>\n'
'<h1 id="header-1">Header 1</h1>\n'
- '<h2 id="header-2">Header 2</h2>')
-
+ '<h2 id="header-2">Header 2</h2>'
+ )
+
def testNoMarker(self):
""" Test TOC without a Marker. """
text = '# Header 1\n\n## Header 2'
- self.assertEqual(self.md.convert(text),
+ self.assertEqual(
+ self.md.convert(text),
'<h1 id="header-1">Header 1</h1>\n'
- '<h2 id="header-2">Header 2</h2>')
- self.assertEqual(self.md.toc,
+ '<h2 id="header-2">Header 2</h2>'
+ )
+ self.assertEqual(
+ self.md.toc,
'<div class="toc">\n'
- '<ul>\n'
- '<li><a href="#header-1">Header 1</a>'
- '<ul>\n'
- '<li><a href="#header-2">Header 2</a></li>\n'
- '</ul>\n'
- '</li>\n'
- '</ul>\n'
- '</div>\n')
+ '<ul>\n' # noqa
+ '<li><a href="#header-1">Header 1</a>' # noqa
+ '<ul>\n' # noqa
+ '<li><a href="#header-2">Header 2</a></li>\n' # noqa
+ '</ul>\n' # noqa
+ '</li>\n' # noqa
+ '</ul>\n' # noqa
+ '</div>\n'
+ )
class TestSmarty(unittest.TestCase):
def setUp(self):
config = {
- 'markdown.extensions.smarty': [
- ('smart_angled_quotes', True),
- ('substitutions', {
- 'ndash': '\u2013',
- 'mdash': '\u2014',
- 'ellipsis': '\u2026',
- 'left-single-quote': '&sbquo;', # sb is not a typo!
- 'right-single-quote': '&lsquo;',
- 'left-double-quote': '&bdquo;',
- 'right-double-quote': '&ldquo;',
- 'left-angle-quote': '[',
- 'right-angle-quote': ']',
- }),]
+ 'markdown.extensions.smarty': [
+ ('smart_angled_quotes', True),
+ ('substitutions', {
+ 'ndash': '\u2013',
+ 'mdash': '\u2014',
+ 'ellipsis': '\u2026',
+ 'left-single-quote': '&sbquo;', # sb is not a typo!
+ 'right-single-quote': '&lsquo;',
+ 'left-double-quote': '&bdquo;',
+ 'right-double-quote': '&ldquo;',
+ 'left-angle-quote': '[',
+ 'right-angle-quote': ']',
+ }),
+ ]
}
- self.md = markdown.Markdown(extensions=['markdown.extensions.smarty'],
- extension_configs=config)
-
+ self.md = markdown.Markdown(
+ extensions=['markdown.extensions.smarty'],
+ extension_configs=config
+ )
+
def testCustomSubstitutions(self):
- text = \
-"""<< The "Unicode char of the year 2014"
+ text = """<< The "Unicode char of the year 2014"
is the 'mdash': ---
Must not be confused with 'ndash' (--) ... >>
"""
- correct = \
-"""<p>[ The &bdquo;Unicode char of the year 2014&ldquo;
+ correct = """<p>[ The &bdquo;Unicode char of the year 2014&ldquo;
is the &sbquo;mdash&lsquo;: \u2014
Must not be confused with &sbquo;ndash&lsquo; (\u2013) \u2026 ]</p>"""
self.assertEqual(self.md.convert(text), correct)