aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_extensions.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2014-12-30 11:00:27 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2014-12-30 11:12:56 -0500
commit52b9f8c1ea191ce9c1ae0cd485306460cb52f71b (patch)
treedf18aad433a4f171c12f76c3876c262818498857 /tests/test_extensions.py
parent257c0fe9aad40879ebe9b6e84613d5c3a5adf2b5 (diff)
downloadmarkdown-52b9f8c1ea191ce9c1ae0cd485306460cb52f71b.tar.gz
markdown-52b9f8c1ea191ce9c1ae0cd485306460cb52f71b.tar.bz2
markdown-52b9f8c1ea191ce9c1ae0cd485306460cb52f71b.zip
Add reset support to TOC extension.
Now, whenever the TOC extensiuon is loaded, the Markdown class instance will always have a toc attribute (md.toc). Calling md.reset() will also reset the toc attribute which defaults to an empty string.
Diffstat (limited to 'tests/test_extensions.py')
-rw-r--r--tests/test_extensions.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index e24118f..2380f17 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -733,6 +733,14 @@ class TestTOC(unittest.TestCase):
'</div>\n'
)
+ def testReset(self):
+ """ Test TOC Reset. """
+ self.assertEqual(self.md.toc, '')
+ self.md.convert('# Header 1\n\n## Header 2')
+ self.assertTrue(self.md.toc.startswith('<div class="toc">'))
+ self.md.reset()
+ self.assertEqual(self.md.toc, '')
+
class TestSmarty(unittest.TestCase):
def setUp(self):