Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 7
0
 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)
Esempio n. 8
0
 def testInputFileOption(self):
     options, logging_level = parse_options(['foo.txt'])
     self.default_options['input'] = 'foo.txt'
     self.assertEqual(options, self.default_options)
Esempio n. 9
0
 def testNoisyOption(self):
     options, logging_level = parse_options(['--noisy'])
     self.assertEqual(logging_level, DEBUG)
Esempio n. 10
0
 def testVerboseOption(self):
     options, logging_level = parse_options(['-v'])
     self.assertEqual(logging_level, INFO)
Esempio n. 11
0
 def testNoisyOption(self):
     options, logging_level = parse_options(['--noisy'])
     self.assertEqual(logging_level, DEBUG)
Esempio n. 12
0
 def testNoLazyOlOption(self):
     options, logging_level = parse_options(['-n'])
     self.default_options['lazy_ol'] = False
     self.assertEqual(options, self.default_options)
Esempio n. 13
0
 def testSafeModeOption(self):
     options, logging_level = parse_options(['-s', 'escape'])
     self.default_options['safe_mode'] = 'escape'
     self.assertEqual(options, self.default_options)
Esempio n. 14
0
 def testQuietOption(self):
     options, logging_level = parse_options(['-q'])
     self.assertTrue(logging_level > CRITICAL)
Esempio n. 15
0
 def testNoLazyOlOption(self):
     options, logging_level = parse_options(['-n'])
     self.default_options['lazy_ol'] = False
     self.assertEqual(options, self.default_options)
Esempio n. 16
0
 def testOutputFormatOption(self):
     options, logging_level = parse_options(['-o', 'html5'])
     self.default_options['output_format'] = 'html5'
     self.assertEqual(options, self.default_options)
Esempio n. 17
0
 def testSafeModeOption(self):
     options, logging_level = parse_options(['-s', 'escape'])
     self.default_options['safe_mode'] = 'escape'
     self.assertEqual(options, self.default_options)
Esempio n. 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)
Esempio n. 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)
Esempio n. 20
0
 def testInputFileOption(self):
     options, logging_level = parse_options(['foo.txt'])
     self.default_options['input'] = 'foo.txt'
     self.assertEqual(options, self.default_options)
Esempio n. 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)
Esempio n. 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)
Esempio n. 23
0
 def testNoOptions(self):
     options, logging_level = parse_options([])
     self.assertEqual(options, self.default_options)
     self.assertEqual(logging_level, CRITICAL)
Esempio n. 24
0
 def testOutputFormatOption(self):
     options, logging_level = parse_options(['-o', 'html5'])
     self.default_options['output_format'] = 'html5'
     self.assertEqual(options, self.default_options)
Esempio n. 25
0
 def testNoOptions(self):
     options, logging_level = parse_options([])
     self.assertEqual(options, self.default_options)
     self.assertEqual(logging_level, CRITICAL)
Esempio n. 26
0
 def testQuietOption(self):
     options, logging_level = parse_options(['-q'])
     self.assertGreater(logging_level, CRITICAL)
Esempio n. 27
0
 def testQuietOption(self):
     options, logging_level = parse_options(['-q'])
     self.assertTrue(logging_level > CRITICAL)
Esempio n. 28
0
 def testExtensionOption(self):
     options, logging_level = parse_options(['-x', 'footnotes'])
     self.default_options['extensions'] = ['footnotes']
     self.assertEqual(options, self.default_options)
Esempio n. 29
0
 def testVerboseOption(self):
     options, logging_level = parse_options(['-v'])
     self.assertEqual(logging_level, WARNING)