From 1bf9e023e4f682aa825f1f0a2d321aebe2f1637b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=A3=92=E6=A3=92?= Date: Mon, 22 Jan 2024 18:53:40 +0800 Subject: [PATCH] add new test. --- tests/metagpt/actions/test_execute_code.py | 40 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/tests/metagpt/actions/test_execute_code.py b/tests/metagpt/actions/test_execute_code.py index ecddccf6f..21627e6f9 100644 --- a/tests/metagpt/actions/test_execute_code.py +++ b/tests/metagpt/actions/test_execute_code.py @@ -1,7 +1,6 @@ import pytest from metagpt.actions.execute_code import ExecutePyCode, truncate -from metagpt.schema import Message @pytest.mark.asyncio @@ -11,9 +10,6 @@ async def test_code_running(): assert output[1] is True output = await pi.run({"code": "print('hello world!')", "language": "python"}) assert output[1] is True - code_msg = Message("print('hello world!')") - output = await pi.run(code_msg) - assert output[1] is True @pytest.mark.asyncio @@ -67,6 +63,15 @@ def test_truncate(): output, is_success = truncate("hello world", 5, False) assert "Truncated to show only last 5 characters\nworld" in output assert not is_success + # 异步 + output, is_success = truncate("