aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_extensions.py
diff options
context:
space:
mode:
authorTiago Serafim <tserafim@gmail.com>2012-09-19 18:37:02 -0300
committerTiago Serafim <tserafim@gmail.com>2012-09-19 18:37:02 -0300
commit9756cb9f6014347179a9acf54a739aad5dda0c6d (patch)
tree7228a0ca389962c2f68ff5a341d38d4279c64012 /tests/test_extensions.py
parentbcfe4257299034eed6aae8351d115c7691db3a3e (diff)
downloadmarkdown-9756cb9f6014347179a9acf54a739aad5dda0c6d.tar.gz
markdown-9756cb9f6014347179a9acf54a739aad5dda0c6d.tar.bz2
markdown-9756cb9f6014347179a9acf54a739aad5dda0c6d.zip
More tests for the extension and new tests for the RE. It's now possible to use an explicit blank title to not have the <p> tag with the title rendered.
Diffstat (limited to 'tests/test_extensions.py')
-rw-r--r--tests/test_extensions.py30
1 files changed, 9 insertions, 21 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index 78c6d9d..7661347 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -278,25 +278,13 @@ class TestAdmonition(unittest.TestCase):
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. """
-
- md = markdown.Markdown(
- extensions=['admonition'],
- extension_configs={},
- 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>')
+ def testRE(self):
+ RE = self.md.parser.blockprocessors['admonition'].RE
+ tests = [
+ ('!!! note', ('note', None)),
+ ('!!! note "Please Note"', ('note', 'Please Note')),
+ ('!!! note ""', ('note', '')),
+ ]
+ for test, expected in tests:
+ self.assertEqual(RE.match(test).groups(), expected)