Exemplo n.º 1
0
def test_mock_fs_mixed_abstraction():
    files = ["file1", "file2", "file3"]
    fs = MockFilesystem({"folder": files})

    assert set(fs.children(Path("/folder"))) == {
        Path("/folder", path) for path in files
    }
Exemplo n.º 2
0
def test_mock_fs_nested_children():
    files = {"file1", "file2.torrent", "file3"}
    fs = MockFilesystem({"upper": {"testing": files}})

    result = set(fs.children(Path("/upper/testing")))

    assert result == {Path("/", "upper", "testing", file) for file in files}
Exemplo n.º 3
0
def test_mock_fs():
    fs = MockFilesystem({"folder": {"file"}})

    assert set(fs.children(Path("/folder"))) == {Path("/folder/file")}
    assert set(fs.children(Path("/"))) == {Path("/folder")}
Exemplo n.º 4
0
def test_mock_fs_iterable():
    files = ["file1", "file2", "file3"]
    fs = MockFilesystem(files)

    assert set(fs.children(Path("/"))) == {Path("/", path) for path in files}