You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tests/test_read_empty_text_notebook.py:8 (test_read_empty_text_notebook[.mnb])
ext = '.mnb'
tmp_path = PosixPath('/tmp/pytest-of-marc/pytest-6/test_read_empty_text_notebook_34')
@pytest.mark.parametrize('ext', set(NOTEBOOK_EXTENSIONS)-{'.ipynb'})
def test_read_empty_text_notebook(ext, tmp_path):
if ext == '.qmd' and not is_quarto_available(min_version="0.2.0"):
pytest.skip("quarto is not available")
if ext in myst_extensions(no_md=True) and not is_myst_available():
pytest.skip('MyST is not available')
empty_nb = (tmp_path / "notebook").with_suffix(ext)
empty_nb.touch()
> nb = jupytext.read(empty_nb)
tests/test_read_empty_text_notebook.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jupytext/jupytext.py:409: in read
return read(stream, as_version=as_version, fmt=fmt, config=config, **kwargs)
jupytext/jupytext.py:418: in read
return reads(fp.read(), fmt, config=config, **kwargs)
jupytext/jupytext.py:370: in reads
notebook = reader.reads(text, **kwargs)
jupytext/jupytext.py:104: in reads
return myst_to_notebook(s)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
text = '', code_directive = '{code-cell}', raw_directive = '{raw-cell}'
add_source_map = False
def myst_to_notebook(
text,
code_directive=CODE_DIRECTIVE,
raw_directive=RAW_DIRECTIVE,
add_source_map=False,
):
"""Convert text written in the myst format to a notebook.
:param text: the file text
:param code_directive: the name of the directive to search for containing code cells
:param raw_directive: the name of the directive to search for containing raw cells
:param add_source_map: add a `source_map` key to the notebook metadata,
which is a list of the starting source line number for each cell.
:raises MystMetadataParsingError if the metadata block is not valid JSON/YAML
NOTE: we assume here that all of these directives are at the top-level,
i.e. not nested in other directives.
"""
raise_if_myst_is_not_available()
tokens = get_parser().parse(text + "\n")
lines = text.splitlines()
md_start_line = 0
# get the document metadata
metadata_nb = {}
> if tokens[0].type == "front_matter":
E IndexError: list index out of range
jupytext/myst.py:286: IndexError
The text was updated successfully, but these errors were encountered:
This can be seen with the test
test_read_empty_text_notebook
at https://github.com/mwouts/jupytext/tree/test_read_empty_text_notebookThe error is the following:
The text was updated successfully, but these errors were encountered: