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

Method testMinMaxLevel

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

TocExtensionClass · 0.90
assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected