fix: 周记按周一至周日生成

This commit is contained in:
Benature
2026-11-22 20:35:36 +08:00
parent 6a55c0d140
commit 8f6831c3e8
6 changed files with 17 additions and 16 deletions

View File

@ -2,7 +2,7 @@ from snooper_version import bump_patch, format_version
def test_version_marks_dirty_worktree_as_dev():
assert format_version("0.1.0", "abc1234", False) == "0.1.0+gabc1234"
assert format_version("0.1.0", "abc1234", False) == "0.1.0"
assert format_version("0.1.0", "abc1234", True) == "0.1.0.dev0+gabc1234"

View File

@ -17,10 +17,11 @@ from snooper_weekly import (
def test_week_bounds_use_monday_and_sunday():
assert week_bounds(date(2024, 7, 4)) == (
date(2024, 6, 30), date(2024, 7, 6)
date(2024, 7, 1), date(2024, 7, 7)
)
assert iso_week_label(date(2024, 6, 30)) == "2024-W26"
assert "# {weekly_date} 周记" in WEEKLY_FINAL_PROMPT
assert iso_week_label(date(2024, 7, 1)) == "2024-W27"
assert "# 周记({week_start} 至 {week_end})" in WEEKLY_FINAL_PROMPT
assert "# {weekly_date} 周记" not in WEEKLY_FINAL_PROMPT
def test_previous_weekly_background_uses_previous_monday(tmp_path):
@ -28,7 +29,7 @@ def test_previous_weekly_background_uses_previous_monday(tmp_path):
"summary": str(tmp_path / "Daily" / "MsgYYYY-MM-DD.md"),
"weekly": str(tmp_path / "Weekly" / "MsgWYYYY-WW.md"),
}
weekly = tmp_path / "Weekly" / "MsgW2024-26.md"
weekly = tmp_path / "Weekly" / "MsgW2024-27.md"
weekly.parent.mkdir(parents=True)
weekly.write_text("---\ntype: weekly\n---\n\n上周合成周记", encoding="utf-8")
@ -49,7 +50,7 @@ def test_generate_weekly_reads_previous_week_and_sanitizes_links(
(daily / f"Msg{day}.md").write_text(
f"---\nmodel: synthetic\n---\n\n# {day}\n合成进展", encoding="utf-8"
)
(weekly / "MsgW2024-26.md").write_text("上周合成周记", encoding="utf-8")
(weekly / "MsgW2024-27.md").write_text("上周合成周记", encoding="utf-8")
config = tmp_path / "config.yaml"
config.write_text(
f"output:\n summary: '{daily}/MsgYYYY-MM-DD.md'\n"