"""测试 LibreOffice DOC Reader 的解析功能。""" import pytest import os from readers.doc import libreoffice class TestLibreOfficeDocReaderParse: """测试 LibreOffice DOC Reader 的 parse 方法。""" def test_simple_doc(self, simple_doc_path): """测试简单 DOC 文件解析。""" content, error = libreoffice.parse(simple_doc_path) if content is not None: # 至少能解析出一些内容 assert content.strip() != "" def test_with_headings_doc(self, with_headings_doc_path): """测试带标题的 DOC 文件解析。""" content, error = libreoffice.parse(with_headings_doc_path) if content is not None: assert content.strip() != "" def test_with_table_doc(self, with_table_doc_path): """测试带表格的 DOC 文件解析。""" content, error = libreoffice.parse(with_table_doc_path) if content is not None: assert content.strip() != "" def test_file_not_exists(self, tmp_path): """测试文件不存在的情况。""" non_existent_file = str(tmp_path / "non_existent.doc") content, error = libreoffice.parse(non_existent_file) assert content is None assert error is not None