From 8aa89a389ae1a7cdafa516be84532b26ed3c565d Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Fri, 29 Aug 2014 15:44:41 -0400 Subject: Refactored tests to no longer pass configs to names extensions. `'path.to.module(option=value'` => `path.to.module.Class(option='value')` This is in anticipation of #335 --- tests/test_extensions.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 0d6df67..a7be627 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -118,7 +118,8 @@ class TestCodeHilite(unittest.TestCase): def testLinenumsTrue(self): text = '\t# A Code Comment' - md = markdown.Markdown(extensions=['markdown.extensions.codehilite(linenums=True)']) + md = markdown.Markdown( + extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=True)]) if self.has_pygments: # Differant versions of pygments output slightly different markup. # So we use 'startwith' and test just enough to confirm that @@ -132,7 +133,8 @@ class TestCodeHilite(unittest.TestCase): def testLinenumsFalse(self): text = '\t#!Python\n\t# A Code Comment' - md = markdown.Markdown(extensions=['markdown.extensions.codehilite(linenums=False)']) + md = markdown.Markdown( + extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=False)]) if self.has_pygments: self.assertEqual(md.convert(text), '
' @@ -145,7 +147,8 @@ class TestCodeHilite(unittest.TestCase): def testLinenumsNone(self): text = '\t# A Code Comment' - md = markdown.Markdown(extensions=['markdown.extensions.codehilite(linenums=None)']) + md = markdown.Markdown( + extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=None)]) if self.has_pygments: self.assertEqual(md.convert(text), '
' @@ -158,7 +161,8 @@ class TestCodeHilite(unittest.TestCase): def testLinenumsNoneWithShebang(self): text = '\t#!Python\n\t# A Code Comment' - md = markdown.Markdown(extensions=['markdown.extensions.codehilite(linenums=None)']) + md = markdown.Markdown( + 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 @@ -172,7 +176,8 @@ class TestCodeHilite(unittest.TestCase): def testLinenumsNoneWithColon(self): text = '\t:::Python\n\t# A Code Comment' - md = markdown.Markdown(extensions=['markdown.extensions.codehilite(linenums=None)']) + md = markdown.Markdown( + extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=None)]) if self.has_pygments: self.assertEqual(md.convert(text), '
' @@ -283,7 +288,7 @@ line 2 line 3 ```''' md = markdown.Markdown(extensions=[ - 'markdown.extensions.codehilite(linenums=None,guess_lang=False)', + markdown.extensions.codehilite.CodeHiliteExtension(linenums=None, guess_lang=False), 'markdown.extensions.fenced_code']) if self.has_pygments: @@ -316,7 +321,7 @@ line 3 ~~~''' for text in (text0, text1): md = markdown.Markdown(extensions=[ - 'markdown.extensions.codehilite(linenums=None,guess_lang=False)', + markdown.extensions.codehilite.CodeHiliteExtension(linenums=None, guess_lang=False), 'markdown.extensions.fenced_code']) if self.has_pygments: @@ -365,7 +370,8 @@ class TestHeaderId(unittest.TestCase): """ Test Header Base Level. """ text = '#Some Header\n## Next Level' - self.assertEqual(markdown.markdown(text, ['markdown.extensions.headerid(level=3)']), + self.assertEqual( + markdown.markdown(text, [markdown.extensions.headerid.HeaderIdExtension(level=3)]), '

Some Header

\n' '

Next Level

') @@ -393,7 +399,8 @@ class TestHeaderId(unittest.TestCase): """ Test HeaderIDs with no auto generated IDs. """ text = '# Some Header\n# Another Header' - self.assertEqual(markdown.markdown(text, ['markdown.extensions.headerid(forceid=False)']), + self.assertEqual( + markdown.markdown(text, [markdown.extensions.headerid.HeaderIdExtension(forceid=False)]), '

Some Header

\n' '

Another Header

') @@ -482,7 +489,9 @@ class TestWikiLinks(unittest.TestCase): """ Test Simple Settings. """ self.assertEqual(markdown.markdown(self.text, - ['markdown.extensions.wikilinks(base_url=/wiki/,end_url=.html,html_class=foo)']), + [markdown.extensions.wikilinks.WikiLinkExtension(base_url='/wiki/', + end_url='.html', + html_class='foo')]), '

Some text with a ' 'WikiLink.

') -- cgit v1.2.3