Skip to content

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

refine tests

geekan78b7e164f93c
diff --git a/metagpt/utils/common.py b/metagpt/utils/common.py
index 60acd7e3c..c7751c2af 100644
--- a/metagpt/utils/common.py
+++ b/metagpt/utils/common.py
@@ -23,7 +23,7 @@ import sys
import traceback
import typing
from pathlib import Path
-from typing import Any, List, Tuple, Union, get_args, get_origin
+from typing import Any, List, Tuple, Union
import aiofiles
import loguru
@@ -147,19 +147,7 @@ class OutputParser:
if extracted_content:
return extracted_content.group(1).strip()
else:
- return "No content found between [CONTENT] and [/CONTENT] tags."
-
- @staticmethod
- def is_supported_list_type(i):
- origin = get_origin(i)
- if origin is not List:
- return False
-
- args = get_args(i)
- if args == (str,) or args == (Tuple[str, str],) or args == (List[str],):
- return True
-
- return False
+ raise ValueError(f"Could not find content between [{tag}] and [/{tag}]")
@classmethod
def parse_data_with_mapping(cls, data, mapping):
diff --git a/tests/metagpt/utils/test_common.py b/tests/metagpt/utils/test_common.py
index 3a0ec18fc..0342a92af 100644
--- a/tests/metagpt/utils/test_common.py
+++ b/tests/metagpt/utils/test_common.py
@@ -91,6 +91,10 @@ class TestGetProjectRoot:
x=(TutorialAssistant, RunCode(), "a"),
want={"metagpt.roles.tutorial_assistant.TutorialAssistant", "metagpt.actions.run_code.RunCode", "a"},
),
+ Input(
+ x={"a": TutorialAssistant, "b": RunCode(), "c": "a"},
+ want={"a", "metagpt.roles.tutorial_assistant.TutorialAssistant", "metagpt.actions.run_code.RunCode"},
+ ),
]
for i in inputs:
v = any_to_str_set(i.x)