示例#1
0
def test_magics_commented_default(ext_and_format_name, commented):
    ext, format_name = parse_one_format(ext_and_format_name)
    nb = new_notebook(cells=[new_code_cell('%pylab inline')])

    text = jupytext.writes(nb, ext, format_name)
    assert ('%pylab inline' in text.splitlines()) != commented
    nb2 = jupytext.reads(text, ext, format_name)

    if format_name == 'sphinx':
        nb2.cells = nb2.cells[1:]

    compare_notebooks(nb, nb2)
示例#2
0
def test_magics_are_not_commented(ext_and_format_name):
    ext, format_name = parse_one_format(ext_and_format_name)
    nb = new_notebook(cells=[new_code_cell('%pylab inline')],
                      metadata={'jupytext': {'comment_magics': False,
                                             'main_language': 'R' if ext == '.R' else 'scheme' if ext == '.ss' else 'python'}})

    text = jupytext.writes(nb, ext, format_name)
    assert '%pylab inline' in text.splitlines()
    nb2 = jupytext.reads(text, ext, format_name)

    if format_name == 'sphinx':
        nb2.cells = nb2.cells[1:]
    compare_notebooks(nb, nb2)