This commit is contained in:
Kevin
2026-04-28 10:41:48 +08:00
parent 482b016872
commit 15884bd68e
60 changed files with 2092 additions and 1994 deletions

View File

@@ -463,3 +463,29 @@ async def test_resolve_already_resolved_status() -> None:
"123456", pid, chosen_label="纱布", rejected=False
)
assert excinfo.value.code == "CONFIRMATION_ALREADY_RESOLVED"
def test_pending_queue_pending_count_fifo() -> None:
settings = Settings()
mgr = CameraSessionManager(
settings=settings,
vision_algorithm=MagicMock(),
hikvision_runtime=None,
result_repository=None,
)
st = SurgerySessionState(candidate_consumables=["纱布"])
for pid in ("p1", "p2"):
st.pending_by_id[pid] = PendingConsumableConfirmation(
id=pid,
status="pending",
options=[("纱布", 0.4)],
prompt_text="x",
created_at=datetime.now(timezone.utc),
model_top1_label="x",
model_top1_confidence=0.4,
)
st.pending_fifo.append(pid)
mgr._registry._active["123456"] = RunningSurgery(
stop_event=asyncio.Event(), state=st, tasks=[]
)
assert mgr.pending_queue_pending_count("123456") == 2