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

Method testXhtml

tests/test_apis.py:549–570  ·  view source on GitHub ↗

Test XHTML serialization.

(self)

Source from the content-addressed store, hash-verified

547 )
548
549 def testXhtml(self):
550 """" Test XHTML serialization. """
551 el = etree.Element('div')
552 el.set('id', 'foo<&">')
553 p = etree.SubElement(el, 'p')
554 p.text = 'foo<&escaped>'
555 p.set('hidden', 'hidden')
556 etree.SubElement(el, 'hr')
557 non_element = etree.SubElement(el, None)
558 non_element.text = 'non-element text'
559 script = etree.SubElement(non_element, 'script')
560 script.text = '<&"test\nescaping">'
561 el.tail = "tail text"
562 self.assertEqual(
563 markdown.serializers.to_xhtml_string(el),
564 '<div id="foo&lt;&amp;&quot;&gt;">'
565 '<p hidden="hidden">foo&lt;&amp;escaped&gt;</p>'
566 '<hr />'
567 'non-element text'
568 '<script><&"test\nescaping"></script>'
569 '</div>tail text'
570 )
571
572 def testMixedCaseTags(self):
573 """" Test preservation of tag case. """

Callers

nothing calls this directly

Calls 1

setMethod · 0.80

Tested by

no test coverage detected