aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_extensions.py
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@10gen.com>2014-01-07 12:55:58 -0500
committerA. Jesse Jiryu Davis <jesse@10gen.com>2014-01-07 12:55:58 -0500
commit1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d (patch)
tree63acf64ec3ef8803a7d7b3bec544bfbf3a390eef /tests/test_extensions.py
parent436b420c1c6bb9db569d6ce4be2d06cff829aea9 (diff)
downloadmarkdown-1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d.tar.gz
markdown-1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d.tar.bz2
markdown-1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d.zip
Allow single as well as double quotes for hl_lines.
Diffstat (limited to 'tests/test_extensions.py')
-rw-r--r--tests/test_extensions.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index ea4adad..d33feec 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -127,21 +127,25 @@ class TestCodeHilite(unittest.TestCase):
'</code></pre>')
def testHighlightLinesWithColon(self):
- text = '\t:::Python hl_lines="2"\n\t#line 1\n\t#line 2\n\t#line 3'
+ # 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"
- md = markdown.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>')
- else:
- self.assertEqual(md.convert(text),
- '<pre class="codehilite"><code class="language-python">#line 1\n'
- '#line 2\n'
- '#line 3</code></pre>')
+ for text in (text0, text1):
+ md = markdown.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>')
+ else:
+ self.assertEqual(md.convert(text),
+ '<pre class="codehilite">'
+ '<code class="language-python">#line 1\n'
+ '#line 2\n'
+ '#line 3</code></pre>')
class TestFencedCode(unittest.TestCase):
""" Test fenced_code extension. """
@@ -248,7 +252,7 @@ line 3
#line 3
```'''
text1 = '''
-~~~{.python hl_lines="1 3"}
+~~~{.python hl_lines='1 3'}
#line 1
#line 2
#line 3