1
0

fix: 修复 7 个失败测试和 1 个错误测试

- 修复 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%
This commit is contained in:
2026-03-03 01:25:36 +08:00
parent e82a6a945e
commit 22614d6f55
9 changed files with 284 additions and 44 deletions

View File

@@ -117,9 +117,7 @@ class PptxFileValidator:
}
for shape in slide.shapes:
if shape.shape_type == MSO_SHAPE.TEXT_BOX:
counts["text_box"] += 1
elif hasattr(shape, "image"):
if hasattr(shape, "image"):
counts["picture"] += 1
elif shape.shape_type in [
MSO_SHAPE.RECTANGLE,
@@ -131,6 +129,8 @@ class PptxFileValidator:
counts["table"] += 1
elif shape.shape_type == MSO_SHAPE.GROUP:
counts["group"] += 1
elif hasattr(shape, "has_text_frame") and shape.has_text_frame:
counts["text_box"] += 1
else:
counts["other"] += 1