Jyo-K's picture
Initial self-play trainer Space sync
6ff67e5 verified
raw
history blame contribute delete
465 Bytes
from darkguard_trainer.parser_utils import parse_action_text
def test_parse_json_action() -> None:
parsed = parse_action_text('{"action_type":"inspect","target_id":"x"}')
assert parsed["action_type"] == "inspect"
assert parsed["target_id"] == "x"
def test_parse_fallback_action() -> None:
parsed = parse_action_text("ACTION: click | TARGET: accept_all")
assert parsed["action_type"] == "click"
assert parsed["target_id"] == "accept_all"