docs: 完善测试文档和 XLS 格式说明

- 补充测试目录结构说明
- 添加完整的运行所有测试命令
- 增加 Core/Utils/HTML 下载器测试说明
- SKILL.md 中补充 XLS 格式支持信息

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 20:12:42 +08:00
parent a578c0b7ac
commit 3b2b368db2
2 changed files with 74 additions and 4 deletions

View File

@@ -136,16 +136,52 @@ uv run \
### 如何测试 ### 如何测试
项目包含完整的测试套件,覆盖 CLI 和所有 Reader 实现。根据测试类型使用对应的 `uv run --with` 命令。 项目包含完整的测试套件,覆盖 CLI、核心模块、工具函数和所有 Reader 实现。根据测试类型使用对应的 `uv run --with` 命令。
#### 测试目录结构
- tests/test_cli/ - CLI 功能测试
- tests/test_core/ - 核心模块测试markdown, parser, advice_generator
- tests/test_readers/ - 各格式 Reader 测试
- tests/test_utils/ - 工具函数测试file_detection, encoding_detection
#### 运行所有测试 #### 运行所有测试
```bash ```bash
uv run \ uv run \
--with pytest \ --with pytest \
--with pytest-cov \ --with pytest-cov \
--with docling \
--with "unstructured[pdf]" \
--with "unstructured[docx]" \
--with "unstructured[xlsx]" \
--with "unstructured[pptx]" \
--with "markitdown[pdf]" \
--with "markitdown[docx]" \
--with "markitdown[xlsx]" \
--with "markitdown[pptx]" \
--with "markitdown[xls]" \
--with pypdf \
--with markdownify \
--with reportlab \
--with pypandoc-binary \
--with python-docx \
--with python-pptx \
--with pandas \
--with tabulate \
--with xlrd \
--with olefile \
--with trafilatura \
--with domscribe \
--with html2text \
--with beautifulsoup4 \
--with httpx \
--with chardet \
--with pyppeteer \
--with selenium \
pytest pytest
``` ```
注:由于依赖较多,也可以按测试类别分别运行(见下文)。
#### 测试 DOCX reader #### 测试 DOCX reader
```bash ```bash
uv run \ uv run \
@@ -236,6 +272,39 @@ uv run \
pytest tests/test_readers/test_xls/ pytest tests/test_readers/test_xls/
``` ```
#### 测试 Core 模块
```bash
# 测试核心模块(无需额外依赖)
uv run \
--with pytest \
pytest tests/test_core/
```
#### 测试 Utils 模块
```bash
# 测试工具函数(无需额外依赖)
uv run \
--with pytest \
pytest tests/test_utils/
```
#### 测试 HTML 下载器
```bash
# 测试 HTML 下载器
uv run \
--with pytest \
--with trafilatura \
--with domscribe \
--with markitdown \
--with html2text \
--with beautifulsoup4 \
--with httpx \
--with chardet \
--with pyppeteer \
--with selenium \
pytest tests/test_readers/test_html_downloader.py
```
#### 运行特定测试文件或方法 #### 运行特定测试文件或方法
```bash ```bash
# 运行特定测试文件CLI 测试无需额外依赖) # 运行特定测试文件CLI 测试无需额外依赖)

View File

@@ -1,6 +1,6 @@
--- ---
name: lyxy-document-reader name: lyxy-document-reader
description: 统一文档解析工具 - 将 DOCX、XLSX、PPTX、PDF、HTML/URL 转换为 Markdown。支持全文输出、字数统计、行数统计、标题提取、章节提取、正则搜索。当用户要求"读取/解析/打开文档"、上传 .docx/.xlsx/.pptx/.pdf/.html 文件、或提供 URL 时使用。 description: 统一文档解析工具 - 将 DOCX、XLS、XLSX、PPTX、PDF、HTML/URL 转换为 Markdown。支持全文输出、字数统计、行数统计、标题提取、章节提取、正则搜索。当用户要求"读取/解析/打开文档"、上传 .docx/.xls/.xlsx/.pptx/.pdf/.html 文件、或提供 URL 时使用。
license: MIT license: MIT
compatibility: Requires Python 3.11+。优先使用 lyxy-runner-python skill次选 uv run --with降级到主机 Python。 compatibility: Requires Python 3.11+。优先使用 lyxy-runner-python skill次选 uv run --with降级到主机 Python。
--- ---
@@ -27,6 +27,7 @@ python scripts/lyxy_document_reader.py <文件路径或URL>
**支持格式** **支持格式**
- DOCXWord 文档) - DOCXWord 文档)
- XLSExcel 旧格式)
- XLSXExcel 表格) - XLSXExcel 表格)
- PPTXPowerPoint 演示文稿) - PPTXPowerPoint 演示文稿)
- PDFPDF 文档,支持 OCR - PDFPDF 文档,支持 OCR
@@ -43,8 +44,8 @@ python scripts/lyxy_document_reader.py <文件路径或URL>
### 触发词 ### 触发词
- 中文:"读取/解析/打开 文档/Word/Excel/PPT/PDF/网页" - 中文:"读取/解析/打开 文档/Word/Excel/PPT/PDF/网页"
- 英文:"read/parse/extract document/docx/xlsx/pptx/pdf/html" - 英文:"read/parse/extract document/docx/xls/xlsx/pptx/pdf/html"
- 文件扩展名:`.docx``.xlsx``.pptx``.pdf``.html``.htm` - 文件扩展名:`.docx``.xls``.xlsx``.pptx``.pdf``.html``.htm`
- URL`http://``https://` - URL`http://``https://`
## Quick Reference ## Quick Reference