File size: 1,289 Bytes
15b8951 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | from vlm.webconsole.demo1.actions import match_action, ACTIONS
def test_match_stand_up_vi_en():
assert match_action("đứng dậy")["api_id"] == 1004
assert match_action("stand up")["api_id"] == 1004
def test_match_hello():
assert match_action("say hello")["api_id"] == 1016
assert match_action("xin chào")["api_id"] == 1016
def test_match_dance_specific_over_generic():
assert match_action("dance 2")["api_id"] == 1023 # cụ thể thắng "dance"
assert match_action("nhảy")["api_id"] == 1022
def test_match_thanks():
assert match_action("cảm ơn")["api_id"] == 1029 # chắp tay lạy (Scrape)
assert match_action("thank you")["api_id"] == 1029
assert match_action("thả tim")["api_id"] == 1036 # khác: thả tim
def test_match_sit():
assert match_action("ngồi")["api_id"] == 1009
def test_question_is_not_action():
assert match_action("is the dog sitting?") is None
def test_non_action_returns_none():
assert match_action("is the bottle on the microwave?") is None
assert match_action("describe the scene") is None
def test_actions_table_has_required_fields():
for a in ACTIONS:
assert {"api_id", "vi", "desc", "keys"} <= set(a)
assert isinstance(a["keys"], list) and a["keys"]
|