Esempio n. 1
0
  def testCode(self):
    raw = textwrap.dedent("""\
        class MarkdownTest(unittest.TestCase):
          def testCode(self):
            pass""")

    expected = textwrap.dedent("""\
        ```python
        class MarkdownTest(unittest.TestCase):
          def testCode(self):
            pass
        ```
        """)
    actual = markdown.md_code(raw, language='python')
    self.assertEquals(expected, actual)
Esempio n. 2
0
  def testCode(self):
    raw = textwrap.dedent("""\
        class MarkdownTest(unittest.TestCase):
          def testCode(self):
            pass""")

    expected = textwrap.dedent("""\
        ```python
        class MarkdownTest(unittest.TestCase):
          def testCode(self):
            pass
        ```
        """)
    actual = markdown.md_code(raw, language='python')
    self.assertEquals(expected, actual)
Esempio n. 3
0
  def testCodeContainsTicks(self):
    raw = textwrap.dedent("""\
        This is sample markdown.
        ```c
        // This is a sample code block.
        int main(int argc, char** argv) {
          return 0;
        }
        ```""")

    expected = textwrap.dedent("""\
        ```
        This is sample markdown.
        \\`\\`\\`c
        // This is a sample code block.
        int main(int argc, char** argv) {
          return 0;
        }
        \\`\\`\\`
        ```
        """)
    actual = markdown.md_code(raw, language=None)
    self.assertEquals(expected, actual)
Esempio n. 4
0
  def testCodeContainsTicks(self):
    raw = textwrap.dedent("""\
        This is sample markdown.
        ```c
        // This is a sample code block.
        int main(int argc, char** argv) {
          return 0;
        }
        ```""")

    expected = textwrap.dedent("""\
        ```
        This is sample markdown.
        \\`\\`\\`c
        // This is a sample code block.
        int main(int argc, char** argv) {
          return 0;
        }
        \\`\\`\\`
        ```
        """)
    actual = markdown.md_code(raw, language=None)
    self.assertEquals(expected, actual)