fix: address daily paper review feedback

This commit is contained in:
jinli.yl 2026-08-26 17:17:41 +08:00
parent b354ed0ae9
commit d2a61212ce
3 changed files with 9 additions and 2 deletions

View file

@ -1,6 +1,6 @@
# Daily Paper Plugin
[中文](README_ZH.md)
[中文](https://github.com/agentscope-ai/ReMe/blob/main/plugins/daily_paper/README_ZH.md)
Daily Paper selects three papers from the Hugging Face Papers weekly and monthly rankings, downloads their arXiv PDFs,
and produces detailed Chinese reading notes plus a roughly five-minute Chinese brief. This directory is an independent

View file

@ -83,7 +83,7 @@ def now(timezone: str | None = None) -> dt.datetime:
return dt.datetime.now()
try:
return dt.datetime.now(zoneinfo.ZoneInfo(timezone))
except (KeyError, zoneinfo.ZoneInfoNotFoundError):
except (KeyError, ValueError, zoneinfo.ZoneInfoNotFoundError):
return dt.datetime.now()

View file

@ -30,6 +30,7 @@ from reme_daily_paper import arxiv as arxiv_utils
from reme_daily_paper import huggingface_papers as hf_utils
from reme_daily_paper.base import (
normalize_chinese_title,
now,
replace_surrogates,
write_atomic,
write_markdown,
@ -95,6 +96,12 @@ def test_daily_paper_replaces_surrogates_in_text_and_titles():
assert normalize_chinese_title("论文\ud800标题", "fallback") == "论文\ufffd标题"
@pytest.mark.parametrize("timezone", ["/etc/localtime", "../UTC", "invalid\x00timezone"])
def test_daily_paper_invalid_timezone_falls_back_to_local_time(timezone: str):
"""Invalid IANA timezone keys retain the workflow's local-time fallback."""
assert now(timezone).tzinfo is None
@pytest.mark.asyncio
async def test_daily_paper_atomic_write_replaces_surrogates(tmp_path: Path):
"""Markdown writes always produce valid UTF-8 even when model output is malformed."""