File size: 1,389 Bytes
69066c5 | 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 70 71 72 | # NeuroSAM 3 Test Suite
Comprehensive test suite for NeuroSAM 3 application.
## Running Tests
Run all tests:
```bash
python -m pytest tests/
```
Run specific test file:
```bash
python -m pytest tests/test_validators.py
python -m pytest tests/test_segmentation.py
python -m pytest tests/test_cache_manager.py
```
Run with verbose output:
```bash
python -m pytest tests/ -v
```
## Test Coverage
### test_validators.py
- File path validation
- File size validation
- File extension validation
- Threshold validation
- Coordinate validation
- Bounding box validation
- Number of masks validation
- Prompt text validation
- Modality validation
- Transparency validation
- Brightness/contrast validation
### test_segmentation.py
- Dice score calculation
- IoU score calculation
- Grid point generation
- ROI statistics formatting
### test_cache_manager.py
- Cache set/get operations
- Cache size limits
- LRU eviction policy
- TTL expiration
- Cache clearing
- Cache statistics
## Adding New Tests
When adding new functionality, create corresponding test files following the naming convention:
- `test_<module_name>.py` for module tests
- Use unittest.TestCase for test classes
- Follow AAA pattern: Arrange, Act, Assert
## Requirements
Tests require:
- pytest (optional, can use unittest)
- numpy
- PIL/Pillow
Install test dependencies:
```bash
pip install pytest pytest-cov
```
|