From 65db6683e6069501a669e73c1eaad3bae7566a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=A3=92=E6=A3=92?= Date: Mon, 11 Dec 2023 15:18:26 +0800 Subject: [PATCH] add new test instance. --- tests/metagpt/actions/test_make_tools.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/metagpt/actions/test_make_tools.py b/tests/metagpt/actions/test_make_tools.py index 4f7d7859a..7811cf7ab 100644 --- a/tests/metagpt/actions/test_make_tools.py +++ b/tests/metagpt/actions/test_make_tools.py @@ -32,3 +32,20 @@ async def test_make_tools2(): result, res_type = await ep.run(tool_code) assert res_type is True print(result) + + +@pytest.mark.asyncio +async def test_make_tools3(): + code = '''import pandas as pd\npath = "./tests/data/test.csv"\ndf = pd.read_csv(path)\ndata = df.copy()\n + data['started_at'] = data['started_at'].apply(lambda r: pd.to_datetime(r))\n + data['ended_at'] = data['ended_at'].apply(lambda r: pd.to_datetime(r))\n + data['duration_hour'] = (data['ended_at'] - data['started_at']).dt.seconds/3600\ndata.head()''' + msgs = [{'role': 'assistant', 'content': code}] + mt = MakeTools() + tool_code = await mt.run(msgs) + print(tool_code) + ep = ExecutePyCode() + tool_code = tool_code + result, res_type = await ep.run(tool_code) + assert res_type is True + print(result)