MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / testMaxLevel

Method testMaxLevel

tests/test_syntax/extensions/test_toc.py:733–784  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

731 )
732
733 def testMaxLevel(self):
734 self.assertMarkdownRenders(
735 self.dedent(
736 '''
737 # Header 1
738
739 ## Header 2
740
741 ### Header 3 not in TOC
742 '''
743 ),
744 self.dedent(
745 '''
746 <h1 id="header-1">Header 1</h1>
747 <h2 id="header-2">Header 2</h2>
748 <h3 id="header-3-not-in-toc">Header 3 not in TOC</h3>
749 ''&#x27;
750 ),
751 expected_attrs={
752 'toc': (
753 '<div class="toc">\n'
754 '<ul>\n' # noqa
755 '<li><a href="#header-1">Header 1</a>' # noqa
756 '<ul>\n' # noqa
757 '<li><a href="#header-2">Header 2</a></li>\n' # noqa
758 '</ul>\n' # noqa
759 '</li>\n' # noqa
760 '</ul>\n' # noqa
761 '</div>\n' # noqa
762 ),
763 'toc_tokens': [
764 {
765 'level': 1,
766 'id': 'header-1',
767 'name': 'Header 1',
768 'html': 'Header 1',
769 'data-toc-label': '',
770 'children': [
771 {
772 'level': 2,
773 'id': 'header-2',
774 'name': 'Header 2',
775 'html': 'Header 2',
776 'data-toc-label': '',
777 'children': []
778 }
779 ]
780 }
781 ]
782 },
783 extensions=[TocExtension(toc_depth=2)]
784 )
785
786 def testMinMaxLevelwithAnchorLink(self):
787 self.assertMarkdownRenders(

Callers

nothing calls this directly

Calls 3

TocExtensionClass · 0.90
assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected