MCPcopy
hub / github.com/Python-Markdown/markdown / testXhtml

Method testXhtml

tests/test_apis.py:525–546  ·  view source on GitHub ↗

Test XHTML serialization.

(self)

Source from the content-addressed store, hash-verified

523 )
524
525 def testXhtml(self):
526 """" Test XHTML serialization. """
527 el = etree.Element('div')
528 el.set('id', 'foo<&">')
529 p = etree.SubElement(el, 'p')
530 p.text = 'foo<&escaped>'
531 p.set('hidden', 'hidden')
532 etree.SubElement(el, 'hr')
533 non_element = etree.SubElement(el, None)
534 non_element.text = 'non-element text'
535 script = etree.SubElement(non_element, 'script')
536 script.text = '<&"test\nescaping">'
537 el.tail = "tail text"
538 self.assertEqual(
539 markdown.serializers.to_xhtml_string(el),
540 '<div id="foo&lt;&amp;&quot;&gt;">'
541 '<p hidden="hidden">foo&lt;&amp;escaped&gt;</p>'
542 '<hr />'
543 'non-element text'
544 '<script><&"test\nescaping"></script>'
545 '</div>tail text'
546 )
547
548 def testMixedCaseTags(self):
549 """" Test preservation of tag case. """

Callers

nothing calls this directly

Calls 1

setMethod · 0.80

Tested by

no test coverage detected