Beispiel #1
0
 def testMultipleExtensionOptions(self):
     options, logging_level = parse_options([
         '-x', 'markdown.extensions.footnotes', '-x',
         'markdown.extensions.smarty'
     ])
     self.default_options['extensions'] = [
         'markdown.extensions.footnotes', 'markdown.extensions.smarty'
     ]
     self.assertEqual(options, self.default_options)
Beispiel #2
0
 def testMultipleExtensionOptions(self):
     options, logging_level = parse_options([
         '-x', 'markdown.extensions.footnotes',
         '-x', 'markdown.extensions.smarty'
     ])
     self.default_options['extensions'] = [
         'markdown.extensions.footnotes',
         'markdown.extensions.smarty'
     ]
     self.assertEqual(options, self.default_options)
Beispiel #3
0
 def textBoolExtensionConfigOption(self):
     config = {
         'markdown.extensions.toc': {
             'title': 'Some Title',
             'anchorlink': True,
             'permalink': True
         }
     }
     self.create_config_file(config)
     options, logging_level = parse_options(['-c', self.tempfile])
     self.default_options['extension_configs'] = config
     self.assertEqual(options, self.default_options)
Beispiel #4
0
 def textBoolExtensionConfigOption(self):
     config = {
         'markdown.extensions.toc': {
             'title': 'Some Title',
             'anchorlink': True,
             'permalink': True
         }
     }
     self.create_config_file(config)
     options, logging_level = parse_options(['-c', self.tempfile])
     self.default_options['extension_configs'] = config
     self.assertEqual(options, self.default_options)
Beispiel #5
0
 def testExtensionConfigOption(self):
     config = {
         'markdown.extensions.wikilinks': {
             'base_url': 'http://example.com/',
             'end_url': '.html',
             'html_class': 'test',
         },
         'markdown.extensions.footnotes:FootnotesExtension': {
             'PLACE_MARKER': '~~~footnotes~~~'
         }
     }
     self.create_config_file(config)
     options, logging_level = parse_options(['-c', self.tempfile])
     self.default_options['extension_configs'] = config
     self.assertEqual(options, self.default_options)
Beispiel #6
0
 def testExtensionConfigOption(self):
     config = {
         'markdown.extensions.wikilinks': {
             'base_url': 'http://example.com/',
             'end_url': '.html',
             'html_class': 'test',
         },
         'markdown.extensions.footnotes:FootnotesExtension': {
             'PLACE_MARKER': '~~~footnotes~~~'
         }
     }
     self.create_config_file(config)
     options, logging_level = parse_options(['-c', self.tempfile])
     self.default_options['extension_configs'] = config
     self.assertEqual(options, self.default_options)
 def testExtensonConfigOptionAsJSON(self):
     config = {
     'wikilinks': {
         'base_url': 'http://example.com/',
         'end_url': '.html',
         'html_class': 'test',
         },
     'footnotes': {
         'PLACE_MARKER': '~~~footnotes~~~'
         }
     }
     import json
     self.create_config_file(json.dumps(config))
     options, logging_level = parse_options(['-c', self.tempfile])
     self.default_options['extension_configs'] = config
     self.assertEqual(options, self.default_options)
Beispiel #8
0
 def testInputFileOption(self):
     options, logging_level = parse_options(['foo.txt'])
     self.default_options['input'] = 'foo.txt'
     self.assertEqual(options, self.default_options)
Beispiel #9
0
 def testNoisyOption(self):
     options, logging_level = parse_options(['--noisy'])
     self.assertEqual(logging_level, DEBUG)
Beispiel #10
0
 def testVerboseOption(self):
     options, logging_level = parse_options(['-v'])
     self.assertEqual(logging_level, INFO)
Beispiel #11
0
 def testNoisyOption(self):
     options, logging_level = parse_options(['--noisy'])
     self.assertEqual(logging_level, DEBUG)
Beispiel #12
0
 def testNoLazyOlOption(self):
     options, logging_level = parse_options(['-n'])
     self.default_options['lazy_ol'] = False
     self.assertEqual(options, self.default_options)
Beispiel #13
0
 def testSafeModeOption(self):
     options, logging_level = parse_options(['-s', 'escape'])
     self.default_options['safe_mode'] = 'escape'
     self.assertEqual(options, self.default_options)
Beispiel #14
0
 def testQuietOption(self):
     options, logging_level = parse_options(['-q'])
     self.assertTrue(logging_level > CRITICAL)
Beispiel #15
0
 def testNoLazyOlOption(self):
     options, logging_level = parse_options(['-n'])
     self.default_options['lazy_ol'] = False
     self.assertEqual(options, self.default_options)
Beispiel #16
0
 def testOutputFormatOption(self):
     options, logging_level = parse_options(['-o', 'html5'])
     self.default_options['output_format'] = 'html5'
     self.assertEqual(options, self.default_options)
Beispiel #17
0
 def testSafeModeOption(self):
     options, logging_level = parse_options(['-s', 'escape'])
     self.default_options['safe_mode'] = 'escape'
     self.assertEqual(options, self.default_options)
Beispiel #18
0
 def testEncodingOption(self):
     options, logging_level = parse_options(['-e', 'utf-8'])
     self.default_options['encoding'] = 'utf-8'
     self.assertEqual(options, self.default_options)
Beispiel #19
0
 def testInputAndOutputFileOptions(self):
     options, logging_level = parse_options(['-f', 'foo.html', 'foo.txt'])
     self.default_options['output'] = 'foo.html'
     self.default_options['input'] = 'foo.txt'
     self.assertEqual(options, self.default_options)
Beispiel #20
0
 def testInputFileOption(self):
     options, logging_level = parse_options(['foo.txt'])
     self.default_options['input'] = 'foo.txt'
     self.assertEqual(options, self.default_options)
Beispiel #21
0
 def testInputAndOutputFileOptions(self):
     options, logging_level = parse_options(['-f', 'foo.html', 'foo.txt'])
     self.default_options['output'] = 'foo.html'
     self.default_options['input'] = 'foo.txt'
     self.assertEqual(options, self.default_options)
Beispiel #22
0
 def testEncodingOption(self):
     options, logging_level = parse_options(['-e', 'utf-8'])
     self.default_options['encoding'] = 'utf-8'
     self.assertEqual(options, self.default_options)
Beispiel #23
0
 def testNoOptions(self):
     options, logging_level = parse_options([])
     self.assertEqual(options, self.default_options)
     self.assertEqual(logging_level, CRITICAL)
Beispiel #24
0
 def testOutputFormatOption(self):
     options, logging_level = parse_options(['-o', 'html5'])
     self.default_options['output_format'] = 'html5'
     self.assertEqual(options, self.default_options)
Beispiel #25
0
 def testNoOptions(self):
     options, logging_level = parse_options([])
     self.assertEqual(options, self.default_options)
     self.assertEqual(logging_level, CRITICAL)
Beispiel #26
0
 def testQuietOption(self):
     options, logging_level = parse_options(['-q'])
     self.assertGreater(logging_level, CRITICAL)
Beispiel #27
0
 def testQuietOption(self):
     options, logging_level = parse_options(['-q'])
     self.assertTrue(logging_level > CRITICAL)
 def testExtensionOption(self):
     options, logging_level = parse_options(['-x', 'footnotes'])
     self.default_options['extensions'] = ['footnotes']
     self.assertEqual(options, self.default_options)
Beispiel #29
0
 def testVerboseOption(self):
     options, logging_level = parse_options(['-v'])
     self.assertEqual(logging_level, WARNING)