aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_apis.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_apis.py')
-rw-r--r--tests/test_apis.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py
index dd232b3..4a7c7c7 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -326,6 +326,38 @@ class testETreeComments(unittest.TestCase):
'<!--foo-->\n')
+class testSerializers(unittest.TestCase):
+ """ Test the html and xhtml serializers. """
+
+ def testHtml(self):
+ """ Test HTML serialization. """
+ el = markdown.util.etree.Element('div')
+ p = markdown.util.etree.SubElement(el, 'p')
+ p.text = 'foo'
+ hr = markdown.util.etree.SubElement(el, 'hr')
+ self.assertEqual(markdown.serializers.to_html_string(el),
+ '<div><p>foo</p><hr></div>')
+
+ def testXhtml(self):
+ """" Test XHTML serialization. """
+ el = markdown.util.etree.Element('div')
+ p = markdown.util.etree.SubElement(el, 'p')
+ p.text = 'foo'
+ hr = markdown.util.etree.SubElement(el, 'hr')
+ self.assertEqual(markdown.serializers.to_xhtml_string(el),
+ '<div><p>foo</p><hr /></div>')
+
+ def testMixedCaseTags(self):
+ """" Test preservation of tag case. """
+ el = markdown.util.etree.Element('MixedCase')
+ el.text = 'not valid '
+ em = markdown.util.etree.SubElement(el, 'EMPHASIS')
+ em.text = 'html'
+ hr = markdown.util.etree.SubElement(el, 'HR')
+ self.assertEqual(markdown.serializers.to_xhtml_string(el),
+ '<MixedCase>not valid <EMPHASIS>html</EMPHASIS><HR /></MixedCase>')
+
+
class testAtomicString(unittest.TestCase):
""" Test that AtomicStrings are honored (not parsed). """