- 删除 5 个过时/残留文档(project_plan/agent_prompt/optimization_plan/report_db_design/deploy/README) - 新建 docs/architecture.md(项目架构:11 包职责+数据模型+配置+产物) - 重写 docs/user-guide.md(CLI 全量+增量/断点续跑+MCP+FAQ) - 重写 README.md(精简入口+文档索引) - 更新 continuation.md(追加本次记录) - 更新 .gitignore(排除 data/* 运行产物)
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""历史导入器单元测试(文件匹配/扫描逻辑,不依赖真实 DB)。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from report_import.importer import _match_file
|
|
|
|
|
|
class TestMatchFile:
|
|
def test_finance(self) -> None:
|
|
p = Path("20260711/finance_news_daily_20260710_0720.html")
|
|
assert _match_file(p, None, None)
|
|
assert _match_file(p, "20260710", None)
|
|
assert _match_file(p, None, "finance")
|
|
assert not _match_file(p, "20260711", None) # 文件名日期不含 20260711
|
|
assert not _match_file(p, None, "intl")
|
|
|
|
def test_no_timestamp_suffix(self) -> None:
|
|
# 早期文件无时间戳后缀,也应匹配
|
|
p = Path("20260616/finance_news_daily_20260616.html")
|
|
assert _match_file(p, None, None)
|
|
assert _match_file(p, "20260616", "finance")
|
|
|
|
def test_intl(self) -> None:
|
|
p = Path("20260711/intl_news_daily_20260711_070304.html")
|
|
assert _match_file(p, "20260711", "intl")
|
|
assert not _match_file(p, None, "finance")
|
|
|
|
def test_non_report_ignored(self) -> None:
|
|
assert not _match_file(Path("20260711/002714.SZ_0724.html"), None, None)
|
|
assert not _match_file(Path("20260711/readme.md"), None, None)
|