From 6a1b408f82d6c7e59730a4641554bdcab492eb21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9F?= Date: Thu, 17 Mar 2016 16:00:01 +0000 Subject: Add single inline code toc tests --- tests/test_extensions.py | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 7a18b94..19a1389 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -775,8 +775,23 @@ class TestTOC(TestCaseWithAssertStartsWith): '

Header 2

' ) - def testAnchorLinkWithInlineCode(self): - """ Test TOC Anchorlink with inline code. """ + def testAnchorLinkWithSingleInlineCode(self): + """ Test TOC Anchorlink with single inline code. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(anchorlink=True)] + ) + text = '# This is `code`.' + self.assertEqual( + md.convert(text), + '

' # noqa + '' # noqa + 'This is code.' # noqa + '' # noqa + '

' # noqa + ) + + def testAnchorLinkWithDoubleInlineCode(self): + """ Test TOC Anchorlink with double inline code. """ md = markdown.Markdown( extensions=[markdown.extensions.toc.TocExtension(anchorlink=True)] ) @@ -804,8 +819,22 @@ class TestTOC(TestCaseWithAssertStartsWith): '' # noqa ) - def testPermalinkWithInlineCode(self): - """ Test TOC Permalink with inline code. """ + def testPermalinkWithSingleInlineCode(self): + """ Test TOC Permalink with single inline code. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(permalink=True)] + ) + text = '# This is `code`.' + self.assertEqual( + md.convert(text), + '

' # noqa + 'This is code.' # noqa + '' # noqa + '

' # noqa + ) + + def testPermalinkWithDoubleInlineCode(self): + """ Test TOC Permalink with double inline code. """ md = markdown.Markdown( extensions=[markdown.extensions.toc.TocExtension(permalink=True)] ) -- cgit v1.2.3