1c1c88e2cf
创建了测试基础设施,为后续计划提供测试框架。 ## 创建的文件 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>
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
"""Tests for SRTProcessor and configuration integration.
|
|
|
|
Test coverage:
|
|
- Configuration integration (CONFIG-01)
|
|
- Backward compatibility (CONFIG-02)
|
|
- Output format verification (OUTPUT-01, OUTPUT-02, OUTPUT-03)
|
|
"""
|
|
|
|
import pytest
|
|
from unittest.mock import MagicMock, patch
|
|
from pathlib import Path
|
|
|
|
|
|
class TestConfigIntegration:
|
|
"""Tests for SRTProcessor configuration integration (CONFIG-01, CONFIG-02)"""
|
|
|
|
def test_srt_processor_reads_from_kbsettings(self):
|
|
"""Test SRTProcessor reads enable_semantic_segmentation from KBSettings"""
|
|
pytest.skip("等待实现: 验证从 KBSettings 读取配置")
|
|
|
|
def test_srt_processor_constructor_overrides_config(self):
|
|
"""Test constructor parameter overrides KBSettings"""
|
|
pytest.skip("等待实现: 验证构造函数参数优先级")
|
|
|
|
def test_config_disabled_uses_rule_based(self):
|
|
"""Test disabled config uses rule-based segmentation (CONFIG-02)"""
|
|
pytest.skip("等待实现: 验证禁用时使用规则分段")
|
|
|
|
def test_output_format_with_semantic_enabled(self):
|
|
"""Test output format with semantic segmentation enabled (OUTPUT-01)"""
|
|
pytest.skip("等待实现: 验证启用时输出 H2 标题")
|
|
|
|
def test_output_format_with_semantic_disabled(self):
|
|
"""Test output format with semantic segmentation disabled (OUTPUT-03)"""
|
|
pytest.skip("等待实现: 验证禁用时输出\"## 内容\"")
|