From f8b379b9735f25ac348af9294268c40b094c914e Mon Sep 17 00:00:00 2001 From: anor Date: Sat, 18 Jul 2026 18:09:52 +1000 Subject: [PATCH] =?UTF-8?q?fix(tests):=20week-=D0=B4=D0=B0=D1=82=D0=B0=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=20=D1=83=D1=81=D1=82=D0=BE=D0=B9=D1=87?= =?UTF-8?q?=D0=B8=D0=B2=20=D0=BA=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20?= =?UTF-8?q?Python=20(fromisoformat=20=D1=81=D1=82=D1=80=D0=BE=D0=B3=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BD=D0=B0=20<3.11)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_session_date.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_session_date.py b/tests/test_session_date.py index 68f883a..df1b221 100644 --- a/tests/test_session_date.py +++ b/tests/test_session_date.py @@ -67,10 +67,13 @@ def test_date_block_actually_injected_into_prompt(): assert "2019-06-01" not in g._build_system_prompt() # без даты — блока нет (обратная совм.) -def test_week_date_rejected_by_roundtrip(): - """Fable: «2019-W01-1» (10 символов, парсится в 2018-12-31) — не каноническая дата, endpoint - отвергает по round-trip (сохраняем d.isoformat(), сверяем с вводом).""" +def test_week_date_rejected(): + """Fable: «2019-W01-1» (10 символов) endpoint отвергает — на Python<3.11 fromisoformat бросает + сразу, на 3.11+ парсится в 2018-12-31, но round-trip не совпадает. Оба пути → 400.""" import datetime - d = datetime.date.fromisoformat("2019-W01-1") - assert d.isoformat() != "2019-W01-1" # не совпало → endpoint вернёт 400 + bad = "2019-W01-1" + try: + assert datetime.date.fromisoformat(bad).isoformat() != bad # 3.11+: не каноническая + except ValueError: + pass # <3.11: отвергнута сразу assert datetime.date.fromisoformat("2019-06-01").isoformat() == "2019-06-01" # обычная — ок