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

Method testMaxLevel

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

TocExtensionClass · 0.90
assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected