From 7d10f204203397c3ab34c20014fef55e3d8ba16d Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Wed, 25 Sep 2013 14:43:18 +0400 Subject: Add tests for the previous two commits --- tests/extensions/test.cfg | 4 ++-- tests/extensions/toc_nested.html | 8 ++++---- tests/extensions/toc_nested2.html | 8 ++++---- tests/test_apis.py | 13 +++++++++++++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/tests/extensions/test.cfg b/tests/extensions/test.cfg index 1a13b1c..494d79b 100644 --- a/tests/extensions/test.cfg +++ b/tests/extensions/test.cfg @@ -16,10 +16,10 @@ extensions=toc extensions=toc [toc_nested] -extensions=toc +extensions=toc(permalink=1) [toc_nested2] -extensions=toc +extensions=toc(permalink=[link]) [wikilinks] extensions=wikilinks diff --git a/tests/extensions/toc_nested.html b/tests/extensions/toc_nested.html index 3703e51..b913640 100644 --- a/tests/extensions/toc_nested.html +++ b/tests/extensions/toc_nested.html @@ -1,7 +1,7 @@ -

Header A

-

Header 1

-

Header i

-

Header B

+

Header A

+

Header 1

+

Header i

+

Header B

-

Start with header other than one.

-

Header 3

-

Header 4

-

Header 3

\ No newline at end of file +

Start with header other than one.[link]

+

Header 3[link]

+

Header 4[link]

+

Header 3[link]

\ No newline at end of file diff --git a/tests/test_apis.py b/tests/test_apis.py index bbe165d..a7d6685 100644 --- a/tests/test_apis.py +++ b/tests/test_apis.py @@ -420,3 +420,16 @@ class testAtomicString(unittest.TestCase): '

*some* *more* *text* *here* ' '*to* *test* *with*

') +class TestConfigParsing(unittest.TestCase): + def assertParses(self, value, result): + self.assertIs(markdown.util.parseBoolValue(value, False), result) + + def testBooleansParsing(self): + self.assertParses(True, True) + self.assertParses('novalue', None) + self.assertParses('yES', True) + self.assertParses('FALSE', False) + self.assertParses(0., False) + + def testInvalidBooleansParsing(self): + self.assertRaises(ValueError, markdown.util.parseBoolValue, 'novalue') -- cgit v1.2.3