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/test_apis.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/test_apis.py') 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