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

Method testMaxLevel

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

Source from the content-addressed store, hash-verified

645 )
646
647 def testMaxLevel(self):
648 self.assertMarkdownRenders(
649 self.dedent(
650 '''
651 # Header 1
652
653 ## Header 2
654
655 ### Header 3 not in TOC
656 '''
657 ),
658 self.dedent(
659 '''
660 <h1 id="header-1">Header 1</h1>
661 <h2 id="header-2">Header 2</h2>
662 <h3 id="header-3-not-in-toc">Header 3 not in TOC</h3>
663 ''&#x27;
664 ),
665 expected_attrs={
666 'toc': (
667 '<div class="toc">\n'
668 '<ul>\n' # noqa
669 '<li><a href="#header-1">Header 1</a>' # noqa
670 '<ul>\n' # noqa
671 '<li><a href="#header-2">Header 2</a></li>\n' # noqa
672 '</ul>\n' # noqa
673 '</li>\n' # noqa
674 '</ul>\n' # noqa
675 '</div>\n' # noqa
676 ),
677 'toc_tokens': [
678 {
679 'level': 1,
680 'id': 'header-1',
681 'name': 'Header 1',
682 'html': 'Header 1',
683 'data-toc-label': '',
684 'children': [
685 {
686 'level': 2,
687 'id': 'header-2',
688 'name': 'Header 2',
689 'html': 'Header 2',
690 'data-toc-label': '',
691 'children': []
692 }
693 ]
694 }
695 ]
696 },
697 extensions=[TocExtension(toc_depth=2)]
698 )
699
700 def testMinMaxLevelwithAnchorLink(self):
701 self.assertMarkdownRenders(

Callers

nothing calls this directly

Calls 3

TocExtensionClass · 0.90
assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected