# Path: onecodex/notebooks/exporters.py
# ASSETS_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "assets"))
# HTML_TEMPLATE_FILE = "notebook_template.tpl"
# CSS_TEMPLATE_FILE = "notebook_template.css"
# class AltairPreprocessor(Preprocessor):
# class OneCodexHTMLExporter(HTMLExporter):
# class OneCodexPDFExporter(OneCodexHTMLExporter):
# class OneCodexDocumentExporter(OneCodexPDFExporter):
#     def convert_cell(self, cell):
#     def preprocess(self, nb, resources):
#     def __init__(self, config=None, **kw):
#     def from_notebook_node(self, nb, resources=None, **kw):
#     def _template_file_default(self):
#     def _file_extension_default(self):
#     def __init__(self, config=None, **kw):
#     def from_notebook_node(self, nb, resources=None, **kw):
#     def _file_extension_default(self):
#     def from_notebook_node(self, nb, resources=None, **kw):
#     def _file_extension_default(self):


import io
import pytest
import nbformat
from traitlets.config import Config
from PyPDF2 import PdfFileReader
from onecodex.notebooks.exporters import HTMLExporter, OneCodexPDFExporter




@pytest.fixture
def nb_config():
    config = Config()
    config.OneCodexPDFExporter.preprocessors = ["nbconvert.preprocessors.ExecutePreprocessor"]
    config.HTMLExporter.preprocessors = ["nbconvert.preprocessors.ExecutePreprocessor"]
    yield config


@pytest.fixture
def nb():
    yield nbformat.read("notebook_examples/example.ipynb", as_version=4)


def test_html_report_generation(capsys, nb, nb_config):
    exporter = HTMLExporter(config=nb_config)
    body, resource = exporter.from_notebook_node(nb)

    # Check visualization is generated
    assert "vega-embed" in body
    assert '<div class="vega-visualization"' in body

    # Check no stderr from vega CLI or similar
    assert capsys.readouterr().err == ""


def test_pdf_report_generation(capsys, nb, nb_config):

# Path: onecodex/notebooks/exporters.py
# ASSETS_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "assets"))
# HTML_TEMPLATE_FILE = "notebook_template.tpl"
# CSS_TEMPLATE_FILE = "notebook_template.css"
# class AltairPreprocessor(Preprocessor):
# class OneCodexHTMLExporter(HTMLExporter):
# class OneCodexPDFExporter(OneCodexHTMLExporter):
# class OneCodexDocumentExporter(OneCodexPDFExporter):
#     def convert_cell(self, cell):
#     def preprocess(self, nb, resources):
#     def __init__(self, config=None, **kw):
#     def from_notebook_node(self, nb, resources=None, **kw):
#     def _template_file_default(self):
#     def _file_extension_default(self):
#     def __init__(self, config=None, **kw):
#     def from_notebook_node(self, nb, resources=None, **kw):
#     def _file_extension_default(self):
#     def from_notebook_node(self, nb, resources=None, **kw):
#     def _file_extension_default(self):


# Path: tests/test_reports.py
import io
import pytest
import nbformat
from traitlets.config import Config
from PyPDF2 import PdfFileReader
from onecodex.notebooks.exporters import HTMLExporter, OneCodexPDFExporter





@pytest.fixture
def nb_config():
    config = Config()
    config.OneCodexPDFExporter.preprocessors = ["nbconvert.preprocessors.ExecutePreprocessor"]
    config.HTMLExporter.preprocessors = ["nbconvert.preprocessors.ExecutePreprocessor"]
    yield config


@pytest.fixture
def nb():
    yield nbformat.read("notebook_examples/example.ipynb", as_version=4)


def test_html_report_generation(capsys, nb, nb_config):
    exporter = HTMLExporter(config=nb_config)
    body, resource = exporter.from_notebook_node(nb)

    # Check visualization is generated
    assert "vega-embed" in body
    assert '<div class="vega-visualization"' in body

    # Check no stderr from vega CLI or similar
    assert capsys.readouterr().err == ""


def test_pdf_report_generation(capsys, nb, nb_config):

    exporter = OneCodexPDFExporter(config=nb_config)