mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-26 17:26:22 +02:00
add new test for list plan.
This commit is contained in:
parent
8a0a89e604
commit
d8ddf1fcb0
1 changed files with 19 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from metagpt.actions.write_code_function import WriteCodeFunction
|
||||
from metagpt.actions.code_executor import PyCodeExecutor
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -20,3 +21,21 @@ async def test_write_code_by_list_prompt():
|
|||
assert "language" in code.content
|
||||
assert "code" in code.content
|
||||
print(code)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_write_code_by_list_plan():
|
||||
coder = WriteCodeFunction()
|
||||
executor = PyCodeExecutor()
|
||||
messages = []
|
||||
plan = ["随机生成一个pandas DataFrame时间序列", "绘制这个时间序列的直方图", "求均值"]
|
||||
for task in plan:
|
||||
print(f"\n任务: {task}\n\n")
|
||||
messages.append(task)
|
||||
code = await coder.run(messages)
|
||||
messages.append(code)
|
||||
assert "language" in code.content
|
||||
assert "code" in code.content
|
||||
output = await executor.run(code)
|
||||
print(f"\n[Output]: 任务{task}的执行结果是: \n{output}\n")
|
||||
messages.append(output)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue