From 8cd1ce45fdd795fafc334bfbe37948557826cdb8 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Mon, 23 Jul 2018 14:13:55 -0400 Subject: Simplify namespace support in serializer. Fixes #679. --- tests/test_apis.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/test_apis.py b/tests/test_apis.py index 251657b..a627c79 100644 --- a/tests/test_apis.py +++ b/tests/test_apis.py @@ -496,6 +496,35 @@ class testSerializers(unittest.TestCase): 'not valid html
' ) + def testQName(self): + """ Test serialization of QName. """ + div = markdown.util.etree.Element('div') + qname = markdown.util.etree.QName('http://www.w3.org/1998/Math/MathML', 'math') + math = markdown.util.etree.SubElement(div, qname) + math.set('display', 'block') + sem = markdown.util.etree.SubElement(math, 'semantics') + msup = markdown.util.etree.SubElement(sem, 'msup') + mi = markdown.util.etree.SubElement(msup, 'mi') + mi.text = 'x' + mn = markdown.util.etree.SubElement(msup, 'mn') + mn.text = '2' + ann = markdown.util.etree.SubElement(sem, 'annotations') + ann.text = 'x^2' + self.assertEqual( + markdown.serializers.to_xhtml_string(div), + '
' + '' + '' + '' + 'x' + '2' + '' + 'x^2' + '' + '' + '
' + ) + def buildExtension(self): """ Build an extension which registers fakeSerializer. """ def fakeSerializer(elem): -- cgit v1.2.3