This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from runtime.planner_prompts import planner_user_prompt
|
||||
|
||||
|
||||
def test_planner_user_prompt_includes_time_zone_and_configured_device_type() -> None:
|
||||
prompt = planner_user_prompt(
|
||||
goal="open settings",
|
||||
scene_json={"screen": {"width": 1, "height": 1}, "elements": []},
|
||||
history_summary=[],
|
||||
device_platform="ios",
|
||||
now=datetime(
|
||||
2026,
|
||||
7,
|
||||
16,
|
||||
9,
|
||||
8,
|
||||
7,
|
||||
tzinfo=timezone(timedelta(hours=8), "Asia/Shanghai"),
|
||||
),
|
||||
)
|
||||
|
||||
assert "Current date and time: 2026-07-16T09:08:07+08:00" in prompt
|
||||
assert "Time zone: Asia/Shanghai" in prompt
|
||||
assert "Device type: ios" in prompt
|
||||
|
||||
|
||||
def test_planner_user_prompt_uses_scene_platform_when_context_is_unavailable() -> None:
|
||||
prompt = planner_user_prompt(
|
||||
goal="open settings",
|
||||
scene_json={
|
||||
"screen": {"width": 1, "height": 1},
|
||||
"elements": [],
|
||||
"app": {"platform": "android"},
|
||||
},
|
||||
history_summary=[],
|
||||
now=datetime(2026, 7, 16, tzinfo=timezone.utc),
|
||||
)
|
||||
|
||||
assert "Device type: android" in prompt
|
||||
Reference in New Issue
Block a user