- 修复 conftest_pptx.py 中元素类型检测:使用 has_text_frame 替代不存在的 MSO_SHAPE.TEXT_BOX - 修复 test_presentation.py 中 3 个测试:使用对象属性访问替代字典访问 - 修复 unit/test_presentation.py 中路径比较问题 - 添加缺失的 mock_template_class fixture 测试通过率: 316/316 (100%) 代码覆盖率: 94%
26 lines
1.2 KiB
Markdown
26 lines
1.2 KiB
Markdown
# 任务清单:修复失败的测试
|
|
|
|
## 1. 修复 conftest_pptx.py 中的元素类型检测
|
|
|
|
- [x] 1.1 修复 `count_elements_by_type` 方法:将 `MSO_SHAPE.TEXT_BOX` 替换为使用 `shape.has_text_frame` 属性检测文本框
|
|
- [x] 1.2 运行修复后的测试验证 `test_image_element_rendering`
|
|
- [x] 1.3 运行修复后的测试验证 `test_shape_element_rendering`
|
|
- [x] 1.4 运行修复后的测试验证 `test_table_element_rendering`
|
|
|
|
## 2. 修复 integration/test_presentation.py 中的测试
|
|
|
|
- [x] 2.1 修复 `test_render_slide_with_template`:使用 `element.type` 和 `element.content` 属性访问,而非字典的 `get` 方法
|
|
- [x] 2.2 修复 `test_render_slide_with_variables`:同上
|
|
- [x] 2.3 修复 `test_render_direct_elements`:使用对象属性访问替换字典访问
|
|
|
|
## 3. 修复 unit/test_presentation.py 中的测试
|
|
|
|
- [x] 3.1 修复 `test_init_with_templates_dir`:将断言中的字符串转换为 Path 对象后比较
|
|
- [x] 3.2 添加缺失的 `mock_template_class` fixture 到 conftest.py
|
|
|
|
## 4. 验证和回归测试
|
|
|
|
- [x] 4.1 运行完整测试套件,确认所有 316 个测试通过
|
|
- [x] 4.2 运行代码覆盖率检查,确认覆盖率 >= 94%
|
|
- [x] 4.3 运行 e2e 测试验证整体功能未受影响
|