---
title: "vuer.workspace.test_workspace"
section: "Python API"
order: 36
description: "Python API reference for vuer.workspace.test_workspace"
---

# vuer.workspace.test_workspace

Tests for the Workspace class.

## test_workspace_init_no_args

```python
def test_workspace_init_no_args()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L19)

Test Workspace initialization with no arguments (defaults to '.').

## test_workspace_init_single_string

```python
def test_workspace_init_single_string()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L26)

Test Workspace initialization with single string path.

## test_workspace_init_single_path

```python
def test_workspace_init_single_path()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L33)

Test Workspace initialization with single Path object.

## test_workspace_init_multiple_strings

```python
def test_workspace_init_multiple_strings()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L40)

Test Workspace initialization with multiple string paths.

## test_workspace_init_mixed_args

```python
def test_workspace_init_mixed_args()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L47)

Test Workspace initialization with mixed string and Path args.

## test_workspace_paths_is_tuple

```python
def test_workspace_paths_is_tuple()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L54)

Test that paths returns a tuple (immutable).

## test_workspace_absolute_paths

```python
def test_workspace_absolute_paths()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L61)

Test absolute_paths property.

## test_workspace_absolute_paths_multiple

```python
def test_workspace_absolute_paths_multiple()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L68)

Test absolute_paths with multiple overlay paths.

## test_workspace_find_file

```python
def test_workspace_find_file()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L83)

Test find() with multiple search paths.

## test_workspace_find_file_first_wins

```python
def test_workspace_find_file_first_wins()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L98)

Test that first matching path wins when file exists in multiple paths.

## test_workspace_find_file_not_found

```python
def test_workspace_find_file_not_found()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L115)

Test find() returns None when file not found.

## test_workspace_find_nested_path

```python
def test_workspace_find_nested_path()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L124)

Test find() with nested file paths.

## test_workspace_repr_single

```python
def test_workspace_repr_single()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L144)

Test workspace string representation with single path.

## test_workspace_repr_multiple

```python
def test_workspace_repr_multiple()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L151)

Test workspace string representation with multiple paths.

## test_workspace_from_config_none

```python
def test_workspace_from_config_none()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L163)

Test workspace_from_config with None.

## test_workspace_from_config_string

```python
def test_workspace_from_config_string()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L171)

Test workspace_from_config with string.

## test_workspace_from_config_path

```python
def test_workspace_from_config_path()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L179)

Test workspace_from_config with Path.

## test_workspace_from_config_list

```python
def test_workspace_from_config_list()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L187)

Test workspace_from_config with list.

## test_workspace_from_config_workspace

```python
def test_workspace_from_config_workspace()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L195)

Test workspace_from_config with existing Workspace.

## test_workspace_from_config_invalid_type

```python
def test_workspace_from_config_invalid_type()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L203)

Test workspace_from_config raises on invalid type.

## test_workspace_overlay_precedence

```python
def test_workspace_overlay_precedence()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L214)

Test that overlay paths are searched in order.

## test_workspace_link_registers_in_links

```python
def test_workspace_link_registers_in_links()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L245)

Test that link() registers in the _links dict.

## test_workspace_link_normalizes_path

```python
def test_workspace_link_normalizes_path()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L254)

Test that link() normalizes paths (adds leading slash, strips trailing).

## test_workspace_link_custom_method

```python
def test_workspace_link_custom_method()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L262)

Test link() with custom HTTP method.

## test_workspace_link_no_request_param

```python
def test_workspace_link_no_request_param()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L270)

Test link() with callable that takes no parameters.

## test_workspace_link_with_request_param

```python
def test_workspace_link_with_request_param()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L281)

Test link() with callable that takes request parameter.

## test_workspace_unlink

```python
def test_workspace_unlink()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L292)

Test unlink() removes a link.

## test_workspace_unlink_nonexistent

```python
def test_workspace_unlink_nonexistent()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L305)

Test unlink() returns False for nonexistent path.

## test_workspace_unlink_normalizes_path

```python
def test_workspace_unlink_normalizes_path()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L314)

Test unlink() normalizes paths.

## test_workspace_handle_link_bytes

```python
async def test_workspace_handle_link_bytes()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L326)

Test handle_link() returns bytes correctly.

## test_workspace_handle_link_dict

```python
async def test_workspace_handle_link_dict()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L341)

Test handle_link() returns dict as JSON.

## test_workspace_handle_link_blob

```python
async def test_workspace_handle_link_blob()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L355)

Test handle_link() returns Blob correctly.

## test_workspace_handle_link_content_type_auto_detect

```python
async def test_workspace_handle_link_content_type_auto_detect()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L370)

Test handle_link() auto-detects content type from path extension.

## test_workspace_handle_link_file

```python
async def test_workspace_handle_link_file()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L383)

Test handle_link() serves Path directly.

## test_workspace_handle_link_file_not_found

```python
async def test_workspace_handle_link_file_not_found()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L400)

Test handle_link() returns 404 for missing file.

## test_workspace_handle_link_static_bytes

```python
async def test_workspace_handle_link_static_bytes()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L412)

Test handle_link() serves bytes directly.

## test_workspace_handle_link_callable_returns_path

```python
async def test_workspace_handle_link_callable_returns_path()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L426)

Test handle_link() handles callable returning Path.

## test_workspace_handle_link_not_found

```python
async def test_workspace_handle_link_not_found()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L444)

Test handle_link() returns None for unknown path.

## test_workspace_handle_link_optional_request

```python
async def test_workspace_handle_link_optional_request()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L455)

Test handle_link() calls handler with or without request based on signature.

## test_workspace_link_dynamic_update

```python
async def test_workspace_link_dynamic_update()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L483)

Test that links can be added/removed dynamically.

## test_jpg_encoder

```python
def test_jpg_encoder()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L508)

Test jpg() encodes numpy array to JPEG bytes.

## test_png_encoder

```python
def test_png_encoder()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L522)

Test png() encodes numpy array to PNG bytes.

## test_jpg_strips_alpha

```python
def test_jpg_strips_alpha()
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/latest/src/vuer/workspace/test_workspace.py#L536)

Test jpg() strips alpha channel.

## Public imports

These symbols are available from this module. Their definitions are documented in the linked modules.

- [`Workspace`](/python-api/workspace/workspace#workspace) — `vuer.workspace.workspace.Workspace`
- [`Blob`](/python-api/workspace/workspace#blob) — `vuer.workspace.workspace.Blob`
- [`workspace_from_config`](/python-api/workspace/workspace#workspace_from_config) — `vuer.workspace.workspace.workspace_from_config`
- [`jpg`](/python-api/workspace/encoders#jpg) — `vuer.workspace.encoders.jpg`
- [`png`](/python-api/workspace/encoders#png) — `vuer.workspace.encoders.png`
