<commit_before>import unittest
from knowru_markdown import markdown_to_html

class TestKnowruMarkdownTestCase(unittest.TestCase):
    def test_paragraph(self):
        result = markdown_to_html('this is a paragraph.')
        self.assertEqual(result, '<p>this is a paragraph.</p>')

    def test_header(self):
        result = markdown_to_html('# this is a header')
        self.assertEqual(result, '<h1>this is a header</h1>')

    def test_figure_without_title_and_caption(self):
        result = markdown_to_html('![Alt text](/path/to/img.jpg)')
        self.assertEqual(result, """<figure>
    <img alt="Alt text" src="/path/to/img.jpg" title="" />
    <figcaption></figcaption>
</figure>
""")

    def test_figure_with_title_but_without_caption(self):
        result = markdown_to_html('![Alt text](/path/to/img.jpg "Optional title")')
        self.assertEqual(result, u"""<figure>
    <img alt="Alt text" src="/path/to/img.jpg" title="Optional title" />
    <figcaption></figcaption>
</figure>
""")

    def test_figure_with_title_and_caption(self):
        result = markdown_to_html('![Alt text](/path/to/img.jpg "Optional title" \'Optional figcaption\')')
        print result
        self.assertEqual(result, u"""<figure>
    <img alt="Alt text" src="/path/to/img.jpg" title="Optional title" />
    <figcaption>Optional figcaption</figcaption>
</figure>
""")

    def test_blockquote_with_footer_and_cite_content_and_title(self):
        result = markdown_to_html('> some content("some footer" ["cite content" "cite title"])')
        self.assertEqual(result, u"""<blockquote>
    <p>some content</p>
    <footer>some footer in <cite title="cite title">cite content</cite></footer>
</blockquote>
""")



if __name__ == '__main__':
    unittest.main()
<commit_msg>added a test for code block and left it as homework<commit_after>import unittest
from knowru_markdown import markdown_to_html

class TestKnowruMarkdownTestCase(unittest.TestCase):
    def test_paragraph(self):
        result = markdown_to_html('this is a paragraph.')
        self.assertEqual(result, '<p>this is a paragraph.</p>')

    def test_header(self):
        result = markdown_to_html('# this is a header')
        self.assertEqual(result, '<h1>this is a header</h1>')

    def test_figure_without_title_and_caption(self):
        result = markdown_to_html('![Alt text](/path/to/img.jpg)')
        self.assertEqual(result, """<figure>
    <img alt="Alt text" src="/path/to/img.jpg" title="" />
    <figcaption></figcaption>
</figure>
""")

    def test_figure_with_title_but_without_caption(self):
        result = markdown_to_html('![Alt text](/path/to/img.jpg "Optional title")')
        self.assertEqual(result, u"""<figure>
    <img alt="Alt text" src="/path/to/img.jpg" title="Optional title" />
    <figcaption></figcaption>
</figure>
""")

    def test_figure_with_title_and_caption(self):
        result = markdown_to_html('![Alt text](/path/to/img.jpg "Optional title" \'Optional figcaption\')')
        print result
        self.assertEqual(result, u"""<figure>
    <img alt="Alt text" src="/path/to/img.jpg" title="Optional title" />
    <figcaption>Optional figcaption</figcaption>
</figure>
""")

    def test_blockquote_with_footer_and_cite_content_and_title(self):
        result = markdown_to_html('> some content("some footer" ["cite content" "cite title"])')
        self.assertEqual(result, u"""<blockquote>
    <p>some content</p>
    <footer>some footer in <cite title="cite title">cite content</cite></footer>
</blockquote>
""")

    def test_code_block(self):
        result = markdown_to_html("""``` python
def sum(a, b):
    return a + b
```""")
        self.assertEqual(result, u"""<pre class="brush: python">
def sum(a, b):
    return a + b
</pre>
""")



if __name__ == '__main__':
    unittest.main()

{'fraction_non_alphanumeric': 0.15665179742849647, 'fraction_numerical': 0.0010495932826029913, 'mean_word_length': 3.9442282749675748, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3557064', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1214, 'n_words': 258}