Commit 5ccbd7b
committed
test(models/inference): add comprehensive unit tests for inference engine
Add test_inference.py with full coverage of models.inference module:
TestGenerationConfig:
- Test default and custom configuration values
- Test to_dict serialization
TestInferenceResult:
- Test default and populated result objects
- Test dictionary conversion
TestExtractSqlFromOutput:
- Test extraction from plain SQL, markdown blocks
- Test XML tags, SQL prefix, WITH/INSERT/UPDATE/DELETE
- Test whitespace handling and no-SQL fallback
TestCalculateConfidence:
- Test empty scores handling
- Test confidence calculation with token probabilities
- Test confidence bounds (0-1)
TestInferenceEngine:
- Test initialization and properties
- Test generate with SQL extraction
- Test token limit and inference exceptions
- Test batch generation with error handling
TestGetInferenceEngine:
- Test singleton pattern
37 tests covering SQL extraction, confidence scoring, and batch processing
Part of Phase 1.3: HuggingFace Model Integration (Issue #3)1 parent f0019a2 commit 5ccbd7b
1 file changed
Lines changed: 560 additions & 0 deletions
0 commit comments