22 lines
685 B
Python
22 lines
685 B
Python
# 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"
|