All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kr.motd.maven.sphinx.dist.CommonMark.tests.unit_tests.py Maven / Gradle / Ivy

There is a newer version: 2.10.0
Show newest version
from __future__ import unicode_literals

import unittest
import CommonMark
from CommonMark.blocks import Parser
from CommonMark.html import HtmlRenderer
from CommonMark.inlines import InlineParser
from CommonMark.node import NodeWalker, Node


class TestCommonmark(unittest.TestCase):
    def test_output(self):
        s = CommonMark.commonmark('*hello!*')
        self.assertEqual(s, '

hello!

\n') def test_unicode(self): s = CommonMark.commonmark('
\u2020
\n') self.assertEqual(s, '
\u2020
\n', 'Unicode works in an HTML block.') CommonMark.commonmark('* unicode: \u2020') CommonMark.commonmark('# unicode: \u2020') CommonMark.commonmark('```\n# unicode: \u2020\n```') class TestHtmlRenderer(unittest.TestCase): def test_init(self): HtmlRenderer() class TestInlineParser(unittest.TestCase): def test_init(self): InlineParser() class TestNode(unittest.TestCase): def test_doc_node(self): Node('Document', [[1, 1], [0, 0]]) class TestNodeWalker(unittest.TestCase): def test_node_walker(self): node = Node('Document', [[1, 1], [0, 0]]) NodeWalker(node) def test_node_walker_iter(self): node = Node('Document', [[1, 1], [0, 0]]) for subnode, entered in node.walker(): pass class TestParser(unittest.TestCase): def setUp(self): self.parser = Parser() def test_empty_string(self): self.parser.parse('') def test_unicode(self): self.parser.parse('* unicode: \u2020')




© 2015 - 2024 Weber Informatics LLC | Privacy Policy