예제 #1
0
def test_get_valid_files(tmp_path):
    fs = DefaultFilesystem()
    fs.create_dir(tmp_path / "test_dir")
    fs.touch(tmp_path / "test_file")

    values = {str(tmp_path / "test_dir" / ".." / "test_file")}

    result = get_valid_files(fs, values)

    assert str(result.pop()) == str(tmp_path / "test_file")
예제 #2
0
def test_validate_files(tmp_path):
    fs = DefaultFilesystem()

    path = tmp_path / "test_directory"
    fs.create_dir(path)
    paths = {path}

    with pytest.raises(Exception) as e:
        validate_files(fs, paths)

    assert "is not a file" in str(e.value)
예제 #3
0
def test_get_valid_paths(tmp_path):
    fs = DefaultFilesystem()
    fs.create_dir(tmp_path / "test_dir")
    fs.touch(tmp_path / "test_file")

    values = {
        str(tmp_path / "test_dir" / ".." / "test_file"),
        str(tmp_path / "test_dir" / ".." / "test_dir"),
    }

    result = get_valid_paths(fs, values)

    assert result == {tmp_path / "test_dir", tmp_path / "test_file"}