def test_get_valid_directories(tmp_path): fs = DefaultFilesystem() fs.touch(tmp_path / "test_file") values = {str(tmp_path / "test_file" / "..")} result = get_valid_directories(fs, values) assert str(result.pop()) == str(tmp_path)
def test_parse_path(tmp_path): fs = DefaultFilesystem() fs.touch(tmp_path / "test_file") value = str(tmp_path / "test_file" / "..") result = parse_path(fs, value) assert result == tmp_path
def test_validate_path_directory(tmp_path): fs = DefaultFilesystem() path = tmp_path / "test_file" fs.touch(path) paths = {path} with pytest.raises(Exception) as e: validate_directories(fs, paths) assert "is not a directory" in str(e.value)
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"}