From b9feac29df15e3d1f0c39d58728977edde5192bb Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 12 Nov 2026 20:24:04 +0900 Subject: [PATCH] =?UTF-8?q?fix(826-2):=20=EB=82=B4=20=EA=B8=B0=EA=B3=84=20?= =?UTF-8?q?=EC=98=AE=EA=B9=80=20=3D=20=EB=8B=A4=EC=9D=8C=20=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=ED=81=B0=20=EC=AA=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 옛 코드 창이 옛 내기계.json 을 다시 써도 폴더 다음 번호가 뒤로 안 감 · 시험 한 줄 Co-Authored-By: Claude Opus 5.5 --- M02_MasterTemplete/M02_MyMachine.py | 4 ++-- resources/tester/test_826_2_machine_files.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/M02_MasterTemplete/M02_MyMachine.py b/M02_MasterTemplete/M02_MyMachine.py index d09a85d72..d1b962409 100644 --- a/M02_MasterTemplete/M02_MyMachine.py +++ b/M02_MasterTemplete/M02_MyMachine.py @@ -92,8 +92,8 @@ def _move(folder: Path | None = None) -> None: for row in got.get("줄") or []: if isinstance(row, dict) and mine(row.get("키")): atomic_write_json(base / f"{row['키']}.json", row) - if not (base / NEXT).is_file(): - atomic_write_json(base / NEXT, {"다음": int(got.get("다음") or 1)}) + had = int(_load(base / NEXT).get("다음") or 1) # 옛 코드 창이 다시 쓴 옛 파일도 — 번호는 큰 쪽 + atomic_write_json(base / NEXT, {"다음": max(had, int(got.get("다음") or 1))}) old.unlink() diff --git a/resources/tester/test_826_2_machine_files.py b/resources/tester/test_826_2_machine_files.py index ae993cd8f..837b4083a 100644 --- a/resources/tester/test_826_2_machine_files.py +++ b/resources/tester/test_826_2_machine_files.py @@ -116,6 +116,8 @@ def test_my_machine_moves_once(tmp_path: Path) -> None: ] # fmt: skip assert mym._read(tmp_path) == old and mym.rows(tmp_path) == rows assert mym._read(tmp_path / "없음") == {"줄": [], "다음": 1} + (tmp_path / mym.FILE).write_text(json.dumps({"줄": [], "다음": 5}), encoding="utf-8") + assert mym._read(tmp_path)["다음"] == 11 # 옛 코드가 다시 쓴 옛 파일 — 번호 뒤로 안 감 # ④ 저장 검사 좁히기 = 옛 길과 같은 오류 ─────────────────────────────────