Spaces:
Runtime error
Runtime error
| # Test Suite | |
| Comprehensive test coverage for the LinguaCustodia Financial AI API. | |
| ## Running Tests | |
| ### Prerequisites | |
| 1. Start the API server: `python app_clean.py` | |
| 2. Install test dependencies: `pip install pytest requests` | |
| ### Run Tests | |
| ```bash | |
| # Run all tests | |
| pytest tests/ | |
| # Run specific test files | |
| pytest tests/test_api.py | |
| pytest tests/test_inference.py | |
| pytest tests/test_openai_compatibility.py | |
| # Run with verbose output | |
| pytest tests/ -v | |
| # Run with coverage | |
| pytest tests/ --cov=app | |
| ``` | |
| ## Test Categories | |
| ### `test_api.py` | |
| - Health check endpoint | |
| - Models listing endpoints | |
| - Import diagnosis endpoint | |
| - Basic API functionality | |
| ### `test_inference.py` | |
| - Basic inference functionality | |
| - Different model parameters | |
| - Error handling | |
| - Performance timing | |
| ### `test_openai_compatibility.py` | |
| - Chat completions endpoint | |
| - Text completions endpoint | |
| - JSON response format | |
| - Streaming responses | |
| - RAG document analysis | |
| ## Test Configuration | |
| Tests automatically skip if the API server is not running. The `conftest.py` file handles: | |
| - API availability checking | |
| - Automatic test skipping | |
| - Common fixtures | |
| ## Expected Behavior | |
| All tests should pass when the API is running properly. Tests cover: | |
| - β API endpoint availability | |
| - β Response format validation | |
| - β OpenAI compatibility | |
| - β Error handling | |
| - β Performance expectations | |