diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_apis.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py index 4a7c7c7..bbe165d 100644 --- a/tests/test_apis.py +++ b/tests/test_apis.py @@ -358,6 +358,24 @@ class testSerializers(unittest.TestCase): '<MixedCase>not valid <EMPHASIS>html</EMPHASIS><HR /></MixedCase>') + def buildExtension(self): + """ Build an extension which registers fakeSerializer. """ + def fakeSerializer(elem): + # Ignore input and return hardcoded output + return '<div><p>foo</p></div>' + + class registerFakeSerializer(markdown.extensions.Extension): + def extendMarkdown(self, md, md_globals): + md.output_formats['fake'] = fakeSerializer + + return registerFakeSerializer() + + def testRegisterSerializer(self): + self.assertEqual(markdown.markdown('baz', + extensions=[self.buildExtension()], output_format='fake'), + '<p>foo</p>') + + class testAtomicString(unittest.TestCase): """ Test that AtomicStrings are honored (not parsed). """ |