<NME> test_compile_markdown.py
<BEF> import io
from os import path

import pytest

from nikola.plugins.compile.markdown import CompileMarkdown

from .helper import FakeSite


@pytest.mark.parametrize(
    "input_str, expected_output",
    [
        pytest.param("", "", id="empty"),
        pytest.param(
            "[podcast]https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3[/podcast]",
            '<p><audio controls=""><source src="https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3" type="audio/mpeg"></source></audio></p>',
            id="mdx podcast",
        ),
        pytest.param(
            "~~striked out text~~",
            "<p><del>striked out text</del></p>",
            id="strikethrough",
        ),
        pytest.param(
            """\
    #!python
    from this
""",
            """\
<div class="code"><table class="codetable"><tr><td class="linenos linenodiv">\
<a href="#-1"><code data-line-number="1"></code></a></td>\
<td class="code"><code><span class="kn">from</span> <span class="nn">this</span>
</code></td></tr></table></div>
""",
            id="hilite",
        ),
    ],
)
def test_compiling_markdown(
    compiler, input_path, output_path, input_str, expected_output
):
    output = markdown_compile(compiler, input_path, output_path, input_str)
    assert output.strip() == expected_output.strip()


@pytest.fixture(scope="module")
def site():
    return FakeSite()


@pytest.fixture(scope="module")
def compiler(site):
    compiler = CompileMarkdown()
    compiler.set_site(site)
    return compiler


@pytest.fixture
def input_path(tmpdir):
    return path.join(str(tmpdir), "input.markdown")


@pytest.fixture
def output_path(tmpdir):
    return path.join(str(tmpdir), "output.html")


def markdown_compile(compiler, input_path, output_path, text):
    with io.open(input_path, "w+", encoding="utf8") as input_file:
        input_file.write(text)

    compiler.compile(input_path, output_path, lang="en")

    with io.open(output_path, "r", encoding="utf8") as output_path:
        return output_path.read()
<p>Cool, eh?</p>
'''

    def test_compile_html_gist(self):
        input_str = '''\
Here's a gist file inline, using reStructuredText syntax:
..gist:: 4747847 zen.py
        self.assertEquals(actual_output.strip(), expected_output.strip())



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

<MSG> one test was overwritten

<DFF> @@ -94,7 +94,7 @@ Cool, eh?
 <p>Cool, eh?</p>
 '''
 
-    def test_compile_html_gist(self):
+    def test_compile_html_gist_2(self):
         input_str = '''\
 Here's a gist file inline, using reStructuredText syntax:
 ..gist:: 4747847 zen.py
@@ -117,6 +117,5 @@ Cool, eh?
         self.assertEquals(actual_output.strip(), expected_output.strip())
 
 
-
 if __name__ == '__main__':
     unittest.main()

{'addition_count': 1, 'commit_subject': 'one test was overwritten', 'deletion_count': 2, 'file_extension': '.py', 'lang': 'py', 'license': 'mit', 'repo_name': 'getnikola/nikola'}