mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
add test
This commit is contained in:
parent
c8b87e28b9
commit
25c42890b8
2 changed files with 25 additions and 6 deletions
|
|
@ -76,6 +76,7 @@ async def test_action_node_one_layer():
|
|||
assert "key-a" in markdown_template
|
||||
|
||||
assert node_dict["key-a"] == "instruction-b"
|
||||
assert "key-a" in repr(node)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -116,11 +117,28 @@ WRITE_TASKS_OUTPUT_MAPPING = {
|
|||
"Anything UNCLEAR": (str, ...),
|
||||
}
|
||||
|
||||
WRITE_TASKS_OUTPUT_MAPPING_MISSING = {
|
||||
"Required Python third-party packages": (str, ...),
|
||||
}
|
||||
|
||||
|
||||
def test_create_model_class():
|
||||
test_class = ActionNode.create_model_class("test_class", WRITE_TASKS_OUTPUT_MAPPING)
|
||||
assert test_class.__name__ == "test_class"
|
||||
|
||||
output = test_class(**t_dict)
|
||||
print(output.schema())
|
||||
assert output.schema()["title"] == "test_class"
|
||||
assert output.schema()["type"] == "object"
|
||||
assert output.schema()["properties"]["Full API spec"]
|
||||
|
||||
|
||||
def test_create_model_class_missing():
|
||||
test_class = ActionNode.create_model_class("test_class", WRITE_TASKS_OUTPUT_MAPPING_MISSING)
|
||||
assert test_class.__name__ == "test_class"
|
||||
|
||||
_ = test_class(**t_dict) # 这里应该要挂掉
|
||||
|
||||
|
||||
def test_create_model_class_with_mapping():
|
||||
t = ActionNode.create_model_class("test_class_1", WRITE_TASKS_OUTPUT_MAPPING)
|
||||
|
|
|
|||
|
|
@ -9,23 +9,24 @@ import pytest
|
|||
from typer.testing import CliRunner
|
||||
|
||||
from metagpt.logs import logger
|
||||
from metagpt.startup import app
|
||||
from metagpt.team import Team
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_team():
|
||||
async def test_empty_team():
|
||||
# FIXME: we're now using "metagpt" cli, so the entrance should be replaced instead.
|
||||
company = Team()
|
||||
company.run_project("做一个基础搜索引擎,可以支持知识库")
|
||||
history = await company.run(n_round=5)
|
||||
history = await company.run(idea="Build a simple search system. I will upload my files later.")
|
||||
logger.info(history)
|
||||
|
||||
|
||||
# def test_startup():
|
||||
# args = ["Make a 2048 game"]
|
||||
# result = runner.invoke(app, args)
|
||||
def test_startup():
|
||||
args = ["Make a 2048 game"]
|
||||
result = runner.invoke(app, args)
|
||||
logger.info(result)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue