3 Commits

Author SHA1 Message Date
starmen1265 1c1c88e2cf test(15-00): add test infrastructure placeholders for Phase 15
创建了测试基础设施,为后续计划提供测试框架。

## 创建的文件

1. **tests/test_processors/test_srt.py** - SRTProcessor 配置集成测试占位符
   - TestConfigIntegration 测试类
   - 5 个测试占位符(pytest.skip)

2. **tests/test_backward_compat.py** - 向后兼容性测试
   - TestBackwardCompatibility 测试类
   - 部分测试已实现(来自计划 15-01)
   - 部分测试占位符(pytest.skip)

3. **tests/conftest.py** - 添加共享 fixtures
   - temp_env_vars fixture:临时环境变量管理
   - mock_kbsettings fixture:Mock KBSettings 实例
   - 添加 os 模块导入

## 偏离说明

计划要求所有测试都是占位符(pytest.skip),但实际上:
- test_config.py 已由计划 15-01 实现完整测试
- test_backward_compat.py 有部分实现

原因:计划 15-01 在 15-00 之前执行,导致测试不是占位符。

## 验证

- pytest 发现所有新增测试类和测试函数
- 测试文件结构符合项目规范

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 23:02:12 +08:00
starmen1265 92c300bb21 test(14-00): add test infrastructure for robustness and cost control
- Add comprehensive test suite in test_semantic_robustness.py
  - TestLLMFailureFallback: LLM调用失败自动降级 (ROBUST-01)
  - TestNonRecoverableErrorDetection: 不可恢复错误检测
  - TestRecoverableErrorDetection: 可恢复错误检测
  - TestRetryMechanism: 重试机制测试
  - TestFallbackToRuleBased: 降级到规则分段 (ROBUST-03)
  - TestLoggingBehavior: 日志记录行为 (ROBUST-04)
  - TestParseFailureRetry: 解析失败重试 (ROBUST-02)
  - TestExtractJSON: JSON提取功能

- Update conftest.py with Phase 14 fixtures:
  - Mock AI clients for different failure scenarios
  - Long text samples for chunking tests (COST-01)
  - Cache-related fixtures (COST-02)
  - Long subtitle segments for testing

- Add TestSemanticSegmentationToggle to test_srt_processor.py (COST-03):
  - Test enabling/disabling semantic segmentation
  - Test cache enable/disable functionality
  - Test configuration switches

All tests follow TDD RED state - failing tests for future implementation
2026-03-23 22:37:49 +08:00
starmen1265 9862da7085 test(13-01): add failing tests for video type detection
- 创建 conftest.py 共享 fixtures(MockAIClient, sample_segments)
- 创建 test_semantic_engine.py 包含 8 个测试用例
  - test_video_type_detection_from_title: 测试从标题推断类型
  - test_video_type_detection_from_category: 测试从分类推断类型
  - test_video_type_fallback_to_default: 测试默认类型回退
  - test_video_type_in_prompt: 测试类型出现在 Prompt 中
  - test_prompt_format: 测试 Prompt 格式
  - test_video_segment_model: 测试 VideoSegment 模型
  - test_segmentation_result_model: 测试 SegmentationResult 模型
  - test_model_validation: 测试字段验证

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 00:23:40 +08:00