[Python-modules-commits] [python-markdown] 02/06: Make code highlighting tests work with Pygments 2.1
Dmitry Shachnev
mitya57 at moszumanska.debian.org
Fri Jan 29 05:32:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
mitya57 pushed a commit to branch master
in repository python-markdown.
commit e0f11f76bb0907009e1bed77ab43cb6841623e9a
Author: Waylan Limberg <waylan.limberg at icloud.com>
Date: Thu Jan 28 22:09:56 2016 -0500
Make code highlighting tests work with Pygments 2.1
Cherry-picked from upstream commit 81b724cfec03634c0bcd88b1bccb5936872d04e2.
---
tests/test_extensions.py | 47 ++++++++++++-----------------------------------
1 file changed, 12 insertions(+), 35 deletions(-)
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index 38f0be3..72ce212 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -134,12 +134,7 @@ class TestCodeHilite(unittest.TestCase):
md = markdown.Markdown(
extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=False)])
if self.has_pygments:
- self.assertEqual(
- md.convert(text),
- '<div class="codehilite">'
- '<pre><span class="c"># A Code Comment</span>\n'
- '</pre></div>'
- )
+ self.assertTrue(md.convert(text).startswith('<div class="codehilite"><pre><span'))
else:
self.assertEqual(
md.convert(text),
@@ -187,12 +182,7 @@ class TestCodeHilite(unittest.TestCase):
extensions=[markdown.extensions.codehilite.CodeHiliteExtension(linenums=None)]
)
if self.has_pygments:
- self.assertEqual(
- md.convert(text),
- '<div class="codehilite">'
- '<pre><span class="c"># A Code Comment</span>\n'
- '</pre></div>'
- )
+ self.assertTrue(md.convert(text).startswith('<div class="codehilite"><pre><span'))
else:
self.assertEqual(
md.convert(text),
@@ -202,19 +192,16 @@ class TestCodeHilite(unittest.TestCase):
def testHighlightLinesWithColon(self):
# Test with hl_lines delimited by single or double quotes.
- text0 = '\t:::Python hl_lines="2"\n\t#line 1\n\t#line 2\n\t#line 3'
- text1 = "\t:::Python hl_lines='2'\n\t#line 1\n\t#line 2\n\t#line 3"
+ text0 = '\t:::Python hl_lines="1"\n\t#line 1\n\t#line 2\n\t#line 3'
+ text1 = "\t:::Python hl_lines='1'\n\t#line 1\n\t#line 2\n\t#line 3"
for text in (text0, text1):
md = markdown.Markdown(extensions=['markdown.extensions.codehilite'])
if self.has_pygments:
- 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>'
+ self.assertTrue(
+ md.convert(text).startswith(
+ '<div class="codehilite"><pre><span class="hll"'
+ )
)
else:
self.assertEqual(
@@ -333,13 +320,8 @@ line 3
)
if self.has_pygments:
- 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>'
+ self.assertTrue(
+ md.convert(text).startswith('<div class="codehilite"><pre><span class="hll"')
)
else:
self.assertEqual(
@@ -372,13 +354,8 @@ line 3
]
)
if self.has_pygments:
- 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>'
+ self.assertTrue(
+ md.convert(text).startswith('<div class="codehilite"><pre><span class="hll"')
)
else:
self.assertEqual(
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-markdown.git
More information about the Python-modules-commits
mailing list