def test_path_to_url_win(): assert path_to_url("c:/tmp/file") == "file:///c:/tmp/file" assert path_to_url("c:\\tmp\\file") == "file:///c:/tmp/file" assert path_to_url(r"\\unc\as\path") == "file://unc/as/path" path = Path(".") / "file" assert path_to_url("file") == "file:///" + path.absolute().as_posix()
def test_url_to_path_path_to_url_symmetry_win(): path = r"C:\tmp\file" assert url_to_path(path_to_url(path)) == Path(path) unc_path = r"\\unc\share\path" assert url_to_path(path_to_url(unc_path)) == Path(unc_path)
def test_path_to_url_unix(): assert path_to_url("/tmp/file") == "file:///tmp/file" path = Path(".") / "file" assert path_to_url("file") == "file://" + path.absolute().as_posix()