From 1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Tue, 7 Jan 2014 12:55:58 -0500 Subject: Allow single as well as double quotes for hl_lines. --- tests/test_extensions.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'tests') 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): '') 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), - '
'
-                '#line 1\n'
-                '#line 2\n'
-                '#line 3\n'
-                '
') - else: - self.assertEqual(md.convert(text), - '
#line 1\n'
-                '#line 2\n'
-                '#line 3
') + for text in (text0, text1): + md = markdown.Markdown(extensions=['codehilite']) + if self.has_pygments: + self.assertEqual(md.convert(text), + '
'
+                    '#line 1\n'
+                    '#line 2\n'
+                    '#line 3\n'
+                    '
') + else: + self.assertEqual(md.convert(text), + '
'
+                    '#line 1\n'
+                    '#line 2\n'
+                    '#line 3
') 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 -- cgit v1.2.3