Skip to content

Commit 08d81b0

Browse files
committed
Make TestCodeHilite work with Pygments ≥ 2.1.1
New versions of Pygments insert <span></span> blocks in the beginning of the generated output sometimes [1], so we need to remove those blocks before doing the actual checking. [1]: https://bitbucket.org/birkenfeld/pygments-main/commits/164574c13533
1 parent 06958b1 commit 08d81b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_extensions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def testHighlightLinesWithColon(self):
209209
if self.has_pygments:
210210
self.assertStartsWith(
211211
'<div class="codehilite"><pre><span class="hll"',
212-
md.convert(text)
212+
md.convert(text).replace('<span></span>', '')
213213
)
214214
else:
215215
self.assertEqual(
@@ -330,7 +330,7 @@ def testFencedCodeWithHighlightLines(self):
330330
if self.has_pygments:
331331
self.assertStartsWith(
332332
'<div class="codehilite"><pre><span class="hll"',
333-
md.convert(text)
333+
md.convert(text).replace('<span></span>', '')
334334
)
335335
else:
336336
self.assertEqual(
@@ -365,7 +365,7 @@ def testFencedLanguageAndHighlightLines(self):
365365
if self.has_pygments:
366366
self.assertStartsWith(
367367
'<div class="codehilite"><pre><span class="hll"',
368-
md.convert(text)
368+
md.convert(text).replace('<span></span>', '')
369369
)
370370
else:
371371
self.assertEqual(

0 commit comments

Comments
 (0)