This commit is contained in:
shenchucheng 2024-10-11 21:06:34 +08:00
parent 4c55a976c6
commit 61bb7749e4
4 changed files with 22 additions and 6 deletions

View file

@ -1,3 +1,4 @@
import tempfile
from pathlib import Path
from random import random
from tempfile import TemporaryDirectory
@ -6,6 +7,7 @@ import pytest
from metagpt.actions.research import CollectLinks
from metagpt.roles import researcher
from metagpt.team import Team
from metagpt.tools import SearchEngineType
from metagpt.tools.search_engine import SearchEngine
@ -57,5 +59,13 @@ def test_write_report(mocker, context):
assert (researcher.RESEARCH_PATH / f"{i+1}. metagpt.md").read_text().startswith("# Research Report")
@pytest.mark.asyncio
async def test_serialize():
team = Team()
team.hire([researcher.Researcher()])
with tempfile.TemporaryDirectory() as dirname:
team.serialize(Path(dirname) / "team.json")
if __name__ == "__main__":
pytest.main([__file__, "-s"])