"""测试 unstructured XLS Reader 的解析功能。""" import pytest import os from readers.xls import unstructured class TestUnstructuredXlsReaderParse: """测试 unstructured XLS Reader 的 parse 方法。""" def test_module_importable(self): """测试模块可以正确导入。""" assert unstructured is not None assert hasattr(unstructured, 'parse') assert callable(unstructured.parse) def test_file_not_exists(self, tmp_path): """测试文件不存在的情况。""" non_existent_file = str(tmp_path / "non_existent.xls") content, error = unstructured.parse(non_existent_file) # 验证返回 None 和错误信息 assert content is None assert error is not None def test_parse_simple_xls(self, simple_xls_path): """测试解析简单 XLS 文件。""" content, error = unstructured.parse(simple_xls_path) # unstructured 可能需要额外依赖,只要不崩溃即可 if content is not None: assert len(content.strip()) > 0