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

Method testMinMaxLevel

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

Source from the content-addressed store, hash-verified

671 )
672
673 def testMinMaxLevel(self):
674 self.assertMarkdownRenders(
675 self.dedent(
676 '''
677 # Header 1 not in TOC
678
679 ## Header 2 not in TOC
680
681 ### Header 3
682
683 #### Header 4
684
685 ##### Header 5 not in TOC
686 '''
687 ),
688 self.dedent(
689 '''
690 <h1 id="header-1-not-in-toc">Header 1 not in TOC</h1>
691 <h2 id="header-2-not-in-toc">Header 2 not in TOC</h2>
692 <h3 id="header-3">Header 3</h3>
693 <h4 id="header-4">Header 4</h4>
694 <h5 id="header-5-not-in-toc">Header 5 not in TOC</h5>
695 ''&#x27;
696 ),
697 expected_attrs={
698 'toc': (
699 '<div class="toc">\n'
700 '<ul>\n' # noqa
701 '<li><a href="#header-3">Header 3</a>' # noqa
702 '<ul>\n' # noqa
703 '<li><a href="#header-4">Header 4</a></li>\n' # noqa
704 '</ul>\n' # noqa
705 '</li>\n' # noqa
706 '</ul>\n' # noqa
707 '</div>\n' # noqa
708 ),
709 'toc_tokens': [
710 {
711 'level': 3,
712 'id': 'header-3',
713 'name': 'Header 3',
714 'html': 'Header 3',
715 'data-toc-label': '',
716 'children': [
717 {
718 'level': 4,
719 'id': 'header-4',
720 'name': 'Header 4',
721 'html': 'Header 4',
722 'data-toc-label': '',
723 'children': []
724 }
725 ]
726 }
727 ]
728 },
729 extensions=[TocExtension(toc_depth='3-4')]
730 )

Callers

nothing calls this directly

Calls 3

TocExtensionClass · 0.90
assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected