audoWin/tests/test_dummy_llm.py
2025-12-19 16:24:04 +08:00

22 lines
685 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MIT License
# Copyright (c) 2024
"""最小端到端测试Dummy LLM 推理。"""
from autodemo.llm import DummyLLM
from autodemo.schema import ControlSnapshot, EventRecord, Rect
def test_dummy_llm_generate() -> None:
llm = DummyLLM()
ev = EventRecord(
kind="mouse_click",
timestamp=1.0,
data={"x": 1, "y": 2},
control=ControlSnapshot(
AutomationId="btn1", Name="按钮", ClassName="Button", ControlType="Button", BoundingRectangle=Rect(left=0, top=0, right=10, bottom=10)
),
)
spec = llm.generate([ev])
assert spec.steps[0]["action"] == "click"
assert spec.steps[0]["target"]["AutomationId"] == "btn1"