Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

add test for truncate.

刘棒棒cfbf1630841e
diff --git a/tests/metagpt/actions/test_execute_code.py b/tests/metagpt/actions/test_execute_code.py
index 73b5886dc..95f883e12 100644
--- a/tests/metagpt/actions/test_execute_code.py
+++ b/tests/metagpt/actions/test_execute_code.py
@@ -1,6 +1,6 @@
import pytest
-from metagpt.actions.execute_code import ExecutePyCode
+from metagpt.actions.execute_code import ExecutePyCode, truncate
from metagpt.schema import Message
@@ -81,3 +81,10 @@ async def test_plotting_bug():
pi = ExecutePyCode()
output = await pi.run(code)
assert output[1] is True
+
+
+def test_truncate():
+ output = "hello world"
+ assert truncate(output) == output
+ output = "hello world"
+ assert truncate(output, 5) == "Truncated to show only the last 5 characters\nworld"