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:
@@ -87,9 +87,7 @@ slides:
|
||||
# 模板变量应该被替换
|
||||
elements = rendered["elements"]
|
||||
title_elem = next(
|
||||
e
|
||||
for e in elements
|
||||
if e.get("type") == "text" and "Test Title" in e.get("content", "")
|
||||
e for e in elements if e.type == "text" and "Test Title" in e.content
|
||||
)
|
||||
assert title_elem is not None
|
||||
|
||||
@@ -157,8 +155,8 @@ slides:
|
||||
|
||||
# 检查变量是否被正确替换
|
||||
elements = rendered["elements"]
|
||||
assert any("My Title" in e.get("content", "") for e in elements)
|
||||
assert any("My Subtitle" in e.get("content", "") for e in elements)
|
||||
assert any("My Title" in e.content for e in elements)
|
||||
assert any("My Subtitle" in e.content for e in elements)
|
||||
|
||||
|
||||
class TestPresentationWithoutTemplate:
|
||||
@@ -187,4 +185,4 @@ slides:
|
||||
|
||||
# 元素应该直接被渲染
|
||||
assert len(rendered["elements"]) == 1
|
||||
assert rendered["elements"][0]["content"] == "Direct Text"
|
||||
assert rendered["elements"][0].content == "Direct Text"
|
||||
|
||||
Reference in New Issue
Block a user