Ejemplo n.º 1
0
def test_paired_paths_windows_no_subfolder():
    nb_file = "C:\\Users\\notebooks\\notebooks\\nb.ipynb"
    formats = "notebooks///ipynb,scripts///py"
    with mock.patch("os.path.sep", "\\"):
        assert base_path(nb_file,
                         "notebooks///ipynb") == "C:\\Users\\notebooks\\//nb"
        paired_paths(nb_file, "notebooks///ipynb", formats)
Ejemplo n.º 2
0
def test_base_path_in_tree_from_non_root_no_subfolder():
    nb_file = "/parent/notebooks/wrap_markdown.ipynb"
    formats = "notebooks///ipynb,scripts///py:percent"
    fmt = "notebooks///ipynb"
    assert base_path(nb_file, fmt) == "/parent///wrap_markdown"
    paired_paths(nb_file, fmt, formats)
Ejemplo n.º 3
0
def test_base_path_in_tree_from_non_root():
    fmt = long_form_one_format("scripts///py")
    assert (
        base_path("/parent_folder/scripts/subfolder/test.py", fmt=fmt)
        == "/parent_folder///subfolder/test"
    )
Ejemplo n.º 4
0
def test_base_path_dotdot():
    fmt = long_form_one_format("../scripts//py")
    assert base_path("scripts/test.py", fmt=fmt) == "scripts/test"
Ejemplo n.º 5
0
def test_base_path():
    fmt = long_form_one_format("dir/prefix_/ipynb")
    assert base_path("dir/prefix_NAME.ipynb", fmt) == "NAME"
    with pytest.raises(InconsistentPath):
        base_path("dir/incorrect_prefix_NAME.ipynb", fmt)
Ejemplo n.º 6
0
def test_base_path():
    fmt = long_form_one_format('dir/prefix_/ipynb')
    assert base_path('dir/prefix_NAME.ipynb', fmt) == 'NAME'
    with pytest.raises(InconsistentPath):
        base_path('dir/incorrect_prefix_NAME.ipynb', fmt)