| 13 | |
| 14 | |
| 15 | class TestActionParser(unittest.TestCase): |
| 16 | def test_parse_action(self): |
| 17 | action_str = "click(point='<point>200 300</point>')" |
| 18 | result = parse_action(action_str) |
| 19 | self.assertEqual(result['function'], 'click') |
| 20 | self.assertEqual(result['args']['point'], '<point>200 300</point>') |
| 21 | |
| 22 | def test_parse_action_to_structure_output(self): |
| 23 | text = "Thought: test\nAction: click(point='<point>200 300</point>')" |
| 24 | actions = parse_action_to_structure_output( |
| 25 | text, factor=1000, origin_resized_height=224, origin_resized_width=224 |
| 26 | ) |
| 27 | self.assertEqual(actions[0]['action_type'], 'click') |
| 28 | self.assertIn('start_box', actions[0]['action_inputs']) |
| 29 | |
| 30 | def test_parsing_response_to_pyautogui_code(self): |
| 31 | responses = {"action_type": "hotkey", "action_inputs": {"hotkey": "ctrl v"}} |
| 32 | code = parsing_response_to_pyautogui_code(responses, 224, 224) |
| 33 | self.assertIn('pyautogui.hotkey', code) |
| 34 | |
| 35 | |
| 36 | if __name__ == '__main__': |
nothing calls this directly
no outgoing calls
no test coverage detected