def test_nbconv_file_contents(tmp_path: Path): """Run ``nbconv`` with the ``exporter`` or ``out_file`` argument.""" nb = make_notebook(tmp_path) assert nbconv(in_file=nb, exporter="html")[1].startswith("<!DOCTYPE html>") assert nbconv(in_file=nb, out_file="o.html")[1].startswith("<!DOCTYPE html") assert nbconv(in_file=nb, out_file="o.___")[1].startswith("<!DOCTYPE html>") assert nbconv(in_file=nb, out_file="o.asc")[1].startswith("\n[[background]") assert nbconv(in_file=nb, exporter="rst")[1].startswith("\nBackground\n") assert nbconv(in_file=nb, out_file="o.rst")[1].startswith("\nBackground\n")
def test_nbconv(exporters, tmp_path: Path) -> None: """Convert ``tempfiles`` with each exporter in ``exporters``.""" nb = make_temp_notebook(tmp_path) assert nbconv(in_file=nb, exporter=exporters)[0].endswith("." + exporters)
def test_raises(not_exporters, tmp_path: Path) -> None: """Make sure a ValueError is raised if nbconv() gets a bad exporter.""" nb = make_temp_notebook(tmp_path) with pytest.raises(ValueError): nbconv(in_file=nb, exporter=not_exporters)
def test_nbconv(exporters, tmp_path: Path) -> None: """Convert a temporary notebook with each exporter in ``exporters``.""" nb = make_notebook(tmp_path) assert nbconv(in_file=nb, exporter=exporters)[0].endswith("." + exporters) assert nbconv(in_file=nb)[0].endswith(".html")
def test_raises(not_exporters, tmp_path: Path) -> None: """Make sure a ``ValueError`` is raised if ``nbconv`` gets a bad exporter.""" nb = make_notebook(tmp_path) with pytest.raises(ValueError): nbconv(in_file=nb, exporter=not_exporters) nbconv(in_file=nb, out_file="out." + not_exporters)