Files
Aislo/resources/tester/test_572_2_inflow_cache.py
T
eomsangdonandClaude Opus 5.5 92d952d8ac fix(B04 · B06): 유입 캐시 상한 넷 · 흙막이 보낸 값 열쇠에 프로젝트 · 노선 (PLAN 572-2)
- B04 유입 배열 캐시 = 최근 프로젝트 넷만(_DETAIL_CACHE 꼴) · 서버 켠 뒤 본 프로젝트마다 쌓이던 것
- B06 soilSent 열쇠 = {프로젝트}:{노선}:측점:역할 · 다른 프로젝트 · 노선 같은 측점에 같은 값 안 먹던 흠
- 시험 test_572_2_inflow_cache 새로 · test_54_10 다른 프로젝트 같은 값 · helper_387_4b scope 칸

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:24:07 +09:00

32 lines
874 B
Python

"""572-2 B04 유입 캐시 상한 — 프로젝트 넷만 남김 · 다시 쓴 것은 뒤로."""
import numpy as np
from B04_PreProcess import B04_PreProcess_Router_Inflow as inflow
def _write(path):
np.savez(
path,
x_min=0.0,
y_max=0.0,
cell_m=1.0,
n_rows=1,
n_cols=1,
road_slot=np.zeros(1),
road_chainage=np.zeros(1),
path_length=np.zeros(1),
)
def test_cache_keeps_four_recent(tmp_path, monkeypatch):
monkeypatch.setattr(inflow, "_routing_path", lambda stored: tmp_path / f"{stored}.npz")
inflow._CACHE.clear()
for name in "abcde":
_write(tmp_path / f"{name}.npz")
for name in "abcd":
inflow._load_routing(name)
inflow._load_routing("a") # 다시 씀 → 맨 뒤
inflow._load_routing("e")
assert list(inflow._CACHE) == ["c", "d", "a", "e"]