- 新增 PPT (旧格式) 解析器 - 重构 _utils.py,提取通用 convert_via_libreoffice 函数 - 更新依赖配置,添加 PPT 相关依赖 - 完善文档,更新 README 和 SKILL.md - 添加 PPT 文件检测函数 - 新增 PPT 解析器测试用例
26 lines
903 B
Python
26 lines
903 B
Python
"""测试所有 PPT Readers 的一致性。"""
|
|
|
|
import pytest
|
|
from readers.ppt import libreoffice
|
|
|
|
|
|
class TestPptReadersConsistency:
|
|
"""验证所有 PPT Readers 解析同一文件时核心文字内容一致。"""
|
|
|
|
def test_parsers_importable(self):
|
|
"""测试所有 parser 模块可以正确导入。"""
|
|
# 验证模块导入成功
|
|
assert libreoffice is not None
|
|
assert hasattr(libreoffice, 'parse')
|
|
|
|
def test_parser_functions_callable(self):
|
|
"""测试 parse 函数是可调用的。"""
|
|
assert callable(libreoffice.parse)
|
|
|
|
def test_libreoffice_parse_simple_ppt(self, simple_ppt_path):
|
|
"""测试 LibreOffice 解析简单文件。"""
|
|
content, error = libreoffice.parse(simple_ppt_path)
|
|
# LibreOffice 可能未安装,所以不强制断言成功
|
|
if content is not None:
|
|
assert content.strip() != ""
|