diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2018-07-23 14:13:55 -0400 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2018-07-24 09:19:08 -0400 |
commit | 8cd1ce45fdd795fafc334bfbe37948557826cdb8 (patch) | |
tree | a42f0dcbf0f7ebbb2cccebbe53ac2a1b54bc3d80 /tests | |
parent | 81fb14216e8c1041b4e38969da0996813ad3f4d8 (diff) | |
download | markdown-8cd1ce45fdd795fafc334bfbe37948557826cdb8.tar.gz markdown-8cd1ce45fdd795fafc334bfbe37948557826cdb8.tar.bz2 markdown-8cd1ce45fdd795fafc334bfbe37948557826cdb8.zip |
Simplify namespace support in serializer.
Fixes #679.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_apis.py | 29 |
1 files changed, 29 insertions, 0 deletions
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): '<MixedCase>not valid <EMPHASIS>html</EMPHASIS><HR /></MixedCase>' ) + 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), + '<div>' + '<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">' + '<semantics>' + '<msup>' + '<mi>x</mi>' + '<mn>2</mn>' + '</msup>' + '<annotations>x^2</annotations>' + '</semantics>' + '</math>' + '</div>' + ) + def buildExtension(self): """ Build an extension which registers fakeSerializer. """ def fakeSerializer(elem): |