feat: 添加 doc/xls/ppt 旧格式文档支持
- 新增 DocReader,支持 markitdown 和 pypandoc-binary 解析器 - 新增 XlsReader,支持 unstructured、markitdown 和 pandas+xlrd 解析器 - 新增 PptReader,支持 markitdown 解析器 - 添加 olefile 依赖用于验证 OLE2 格式 - 更新 config.py 添加 doc/xls/ppt 依赖配置 - 更新 --advice 支持 doc/xls/ppt 格式 - 添加相应的测试用例 - 同步 specs 到主目录
This commit is contained in:
25
tests/test_readers/test_doc/test_pypandoc_doc.py
Normal file
25
tests/test_readers/test_doc/test_pypandoc_doc.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""测试 pypandoc DOC Reader 的解析功能。"""
|
||||
|
||||
import pytest
|
||||
import os
|
||||
from readers.doc import pypandoc
|
||||
|
||||
|
||||
class TestPypandocDocReaderParse:
|
||||
"""测试 pypandoc DOC Reader 的 parse 方法。"""
|
||||
|
||||
def test_module_importable(self):
|
||||
"""测试模块可以正确导入。"""
|
||||
assert pypandoc is not None
|
||||
assert hasattr(pypandoc, 'parse')
|
||||
assert callable(pypandoc.parse)
|
||||
|
||||
def test_file_not_exists(self, tmp_path):
|
||||
"""测试文件不存在的情况。"""
|
||||
non_existent_file = str(tmp_path / "non_existent.doc")
|
||||
|
||||
content, error = pypandoc.parse(non_existent_file)
|
||||
|
||||
# 验证返回 None 和错误信息
|
||||
assert content is None
|
||||
assert error is not None
|
||||
Reference in New Issue
Block a user