File size: 1,741 Bytes
8f383ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Mosaic Unit Tests

This directory contains comprehensive unit tests for the Mosaic package.

## Running Tests

To run all tests:

```bash
pytest tests/
```

To run tests with coverage report:

```bash
pytest tests/ --cov=src/mosaic --cov-report=term-missing
```

To run a specific test file:

```bash
pytest tests/inference/test_data.py -v
```

## Test Structure

- `tests/inference/` - Tests for inference modules
  - `test_data.py` - Tests for data structures and datasets
  - `test_aeon.py` - Tests for Aeon inference module
  - `test_paladin.py` - Tests for Paladin inference module
- `tests/test_gradio_app.py` - Tests for Gradio application utilities
- `tests/conftest.py` - Pytest configuration and fixtures

## Test Coverage

Current test coverage includes:

### Data Module (`mosaic.inference.data`)
- βœ… Cancer type mapping constants
- βœ… SiteType enum
- βœ… TileFeatureTensorDataset class
  - Dataset initialization
  - Feature padding and truncation
  - Data type conversions
  - Site type handling

### Aeon Module (`mosaic.inference.aeon`)
- βœ… Module constants
- βœ… Cancer type indices

### Paladin Module (`mosaic.inference.paladin`)
- βœ… Model map loading
- βœ… Aeon score loading
- βœ… Cancer subtype selection
- βœ… Logits to point estimates conversion
- βœ… UsageError exception

### Gradio App Module (`mosaic.gradio_app`)
- βœ… Constants (IHC subtypes, settings columns)
- βœ… Settings loading and validation
- βœ… Oncotree code name retrieval
- βœ… CSV export functionality

## Notes

- Tests use mocking for external dependencies (e.g., mussel models, network requests)
- Some tests require pytest-mock for mocking functionality
- Tests are designed to run without requiring full model downloads or GPU access