aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_extensions.py
diff options
context:
space:
mode:
authorTiago Serafim <tserafim@gmail.com>2012-09-02 20:12:53 -0300
committerTiago Serafim <tserafim@gmail.com>2012-09-02 20:12:53 -0300
commit83382bcefb246f1169b0d01375fcd86cd05b031e (patch)
tree0c58778e87702449f400cedd38e4de130d1a25d5 /tests/test_extensions.py
parent0794f32333bcf9d15f782899538386242c37921e (diff)
downloadmarkdown-83382bcefb246f1169b0d01375fcd86cd05b031e.tar.gz
markdown-83382bcefb246f1169b0d01375fcd86cd05b031e.tar.bz2
markdown-83382bcefb246f1169b0d01375fcd86cd05b031e.zip
Initial version with insufficient tests and no docs.
Diffstat (limited to 'tests/test_extensions.py')
-rw-r--r--tests/test_extensions.py56
1 files changed, 46 insertions, 10 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index 15feb6b..ca1520e 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -2,7 +2,7 @@
Python-Markdown Extension Regression Tests
==========================================
-A collection of regression tests to confirm that the included extensions
+A collection of regression tests to confirm that the included extensions
continue to work as advertised. This used to be accomplished by doctests.
"""
@@ -59,7 +59,7 @@ class TestFencedCode(unittest.TestCase):
def testBasicFence(self):
""" Test Fenced Code Blocks. """
- text = '''
+ text = '''
A paragraph before a fenced code block:
~~~
@@ -123,7 +123,7 @@ class TestHeaderId(unittest.TestCase):
def testBasicHeaderId(self):
""" Test Basic HeaderID """
-
+
text = "# Some Header #"
self.assertEqual(self.md.convert(text),
'<h1 id="some-header">Some Header</h1>')
@@ -189,8 +189,8 @@ The body. This is paragraph one.'''
self.assertEqual(self.md.convert(text),
'<p>The body. This is paragraph one.</p>')
self.assertEqual(self.md.Meta,
- {'author': ['Waylan Limberg', 'John Doe'],
- 'blank_data': [''],
+ {'author': ['Waylan Limberg', 'John Doe'],
+ 'blank_data': [''],
'title': ['A Test Doc.']})
def testMissingMetaData(self):
@@ -226,18 +226,18 @@ class TestWikiLinks(unittest.TestCase):
def testSimpleSettings(self):
""" Test Simple Settings. """
- self.assertEqual(markdown.markdown(self.text,
+ self.assertEqual(markdown.markdown(self.text,
['wikilinks(base_url=/wiki/,end_url=.html,html_class=foo)']),
'<p>Some text with a '
'<a class="foo" href="/wiki/WikiLink.html">WikiLink</a>.</p>')
-
+
def testComplexSettings(self):
""" Test Complex Settings. """
md = markdown.Markdown(
- extensions = ['wikilinks'],
+ extensions = ['wikilinks'],
extension_configs = {'wikilinks': [
- ('base_url', 'http://example.com/'),
+ ('base_url', 'http://example.com/'),
('end_url', '.html'),
('html_class', '') ]},
safe_mode = True)
@@ -268,8 +268,44 @@ Some text with a [[WikiLink]]."""
def my_url_builder(label, base, end):
return '/bar/'
- md = markdown.Markdown(extensions=['wikilinks'],
+ md = markdown.Markdown(extensions=['wikilinks'],
extension_configs={'wikilinks' : [('build_url', my_url_builder)]})
self.assertEqual(md.convert('[[foo]]'),
'<p><a class="wikilink" href="/bar/">foo</a></p>')
+class TestAdmonition(unittest.TestCase):
+ """ Test Admonition Extension. """
+
+ def setUp(self):
+ self.md = markdown.Markdown(extensions=['admonition'])
+ self.text = \
+'''!!! note
+ First line
+
+!!! didyouknow "Did you know?"
+ Another text'''
+
+ def testComplexSettings(self):
+ """ Test Complex Settings. """
+
+ # config = {
+ # 'styles': {
+ # 'note': ('note', 'Please Note'),
+ # 'didyouknow': ('note', 'Did you know?'),
+ # }
+ # }
+
+ md = markdown.Markdown(
+ extensions=['admonition'],
+ extension_configs={
+ 'admonition': []
+ },
+ safe_mode=True)
+ self.assertEqual(md.convert(self.text),
+ '<div class="admonition note">\n'
+ '<p class="admonition-title">Note</p>\n'
+ '<p>First line</p>\n'
+ '</div>\n'
+ '<div class="admonition didyouknow">\n'
+ '<p class="admonition-title">Did you know?</p>\n'
+ '<p>Another text</p>\n</div>')