A newer version of the Gradio SDK is available:
6.2.0
NeuroSAM 3 Test Suite
Comprehensive test suite for NeuroSAM 3 application.
Running Tests
Run all tests:
python -m pytest tests/
Run specific test file:
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:
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>.pyfor 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:
pip install pytest pytest-cov