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

Method testMinMaxLevel

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

Source from the content-addressed store, hash-verified

586 )
587
588 def testMinMaxLevel(self):
589 self.assertMarkdownRenders(
590 self.dedent(
591 '''
592 # Header 1 not in TOC
593
594 ## Header 2 not in TOC
595
596 ### Header 3
597
598 #### Header 4
599
600 ##### Header 5 not in TOC
601 '''
602 ),
603 self.dedent(
604 '''
605 <h1 id="header-1-not-in-toc">Header 1 not in TOC</h1>
606 <h2 id="header-2-not-in-toc">Header 2 not in TOC</h2>
607 <h3 id="header-3">Header 3</h3>
608 <h4 id="header-4">Header 4</h4>
609 <h5 id="header-5-not-in-toc">Header 5 not in TOC</h5>
610 ''&#x27;
611 ),
612 expected_attrs={
613 'toc': (
614 '<div class="toc">\n'
615 '<ul>\n' # noqa
616 '<li><a href="#header-3">Header 3</a>' # noqa
617 '<ul>\n' # noqa
618 '<li><a href="#header-4">Header 4</a></li>\n' # noqa
619 '</ul>\n' # noqa
620 '</li>\n' # noqa
621 '</ul>\n' # noqa
622 '</div>\n' # noqa
623 ),
624 'toc_tokens': [
625 {
626 'level': 3,
627 'id': 'header-3',
628 'name': 'Header 3',
629 'html': 'Header 3',
630 'data-toc-label': '',
631 'children': [
632 {
633 'level': 4,
634 'id': 'header-4',
635 'name': 'Header 4',
636 'html': 'Header 4',
637 'data-toc-label': '',
638 'children': []
639 }
640 ]
641 }
642 ]
643 },
644 extensions=[TocExtension(toc_depth='3-4')]
645 )

Callers

nothing calls this directly

Calls 3

TocExtensionClass · 0.90
assertMarkdownRendersMethod · 0.80
dedentMethod · 0.80

Tested by

no test coverage detected