diff options
author | Waylan Limberg <waylan@gmail.com> | 2013-02-25 10:39:19 -0500 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2013-02-25 10:39:19 -0500 |
commit | e7259d5024c932707371f4e6ea8cbb3a8fe2d214 (patch) | |
tree | 62bf34c128a76c2c2768e6e6cab073c08dd955d3 /tests/test_extensions.py | |
parent | 27c51e24acc702bbd65752d7d779c0cbd1061827 (diff) | |
download | markdown-e7259d5024c932707371f4e6ea8cbb3a8fe2d214.tar.gz markdown-e7259d5024c932707371f4e6ea8cbb3a8fe2d214.tar.bz2 markdown-e7259d5024c932707371f4e6ea8cbb3a8fe2d214.zip |
CodeHilite tests pass in all pygments versions.
Diffstat (limited to 'tests/test_extensions.py')
-rw-r--r-- | tests/test_extensions.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py index d9d77b8..cb27a30 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -54,13 +54,11 @@ class TestCodeHilite(unittest.TestCase): text = '\t# A Code Comment' md = markdown.Markdown(extensions=['codehilite(linenums=True)']) if self.has_pygments: - self.assertEqual(md.convert(text), - '<table class="codehilitetable"><tr>' - '<td class="linenos"><div class="linenodiv"><pre>1</pre></div></td>' - '<td class="code"><div class="codehilite">' - '<pre><span class="c"># A Code Comment</span>\n</pre>' - '</div>\n</td>' - '</tr></table>') + # Differant versions of pygments output slightly different markup. + # 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">')) else: self.assertEqual(md.convert(text), '<pre class="codehilite"><code class="linenums"># A Code Comment' @@ -96,13 +94,11 @@ class TestCodeHilite(unittest.TestCase): text = '\t#!Python\n\t# A Code Comment' md = markdown.Markdown(extensions=['codehilite(linenums=None)']) if self.has_pygments: - self.assertEqual(md.convert(text), - '<table class="codehilitetable"><tr>' - '<td class="linenos"><div class="linenodiv"><pre>1</pre></div></td>' - '<td class="code"><div class="codehilite">' - '<pre><span class="c"># A Code Comment</span>\n</pre>' - '</div>\n</td>' - '</tr></table>') + # Differant versions of pygments output slightly different markup. + # 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">')) else: self.assertEqual(md.convert(text), '<pre class="codehilite"><code class="language-python linenums"># A Code Comment' @@ -416,4 +412,4 @@ class TestTOC(unittest.TestCase): '</ul>\n' '</li>\n' '</ul>\n' - '</div>\n')
\ No newline at end of file + '</div>\n') |