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

Method testNestedAtomicString

tests/test_apis.py:717–736  ·  view source on GitHub ↗

Test that a nested `AtomicString` is not parsed.

(self)

Source from the content-addressed store, hash-verified

715 )
716
717 def testNestedAtomicString(self):
718 """ Test that a nested `AtomicString` is not parsed. """
719 tree = etree.Element('div')
720 p = etree.SubElement(tree, 'p')
721 p.text = markdown.util.AtomicString('*some* ')
722 span1 = etree.SubElement(p, 'span')
723 span1.text = markdown.util.AtomicString('*more* ')
724 span2 = etree.SubElement(span1, 'span')
725 span2.text = markdown.util.AtomicString('*text* ')
726 span3 = etree.SubElement(span2, 'span')
727 span3.text = markdown.util.AtomicString('*here*')
728 span3.tail = markdown.util.AtomicString(' *to*')
729 span2.tail = markdown.util.AtomicString(' *test*')
730 span1.tail = markdown.util.AtomicString(' *with*')
731 new = self.inlineprocessor.run(tree)
732 self.assertEqual(
733 markdown.serializers.to_html_string(new),
734 '<div><p>*some* <span>*more* <span>*text* <span>*here*</span> '
735 '*to*</span> *test*</span> *with*</p></div>'
736 )
737
738 def testInlineProcessorDoesntCrashWithWrongAtomicString(self):
739 """ Test that an `AtomicString` returned from a Pattern doesn't cause a crash. """

Callers

nothing calls this directly

Calls 1

runMethod · 0.45

Tested by

no test coverage detected