mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-30 14:35:17 +02:00
repo_parser add tests
This commit is contained in:
parent
52c74adfb5
commit
feb89ec17f
3 changed files with 31 additions and 20 deletions
|
|
@ -0,0 +1,25 @@
|
|||
from pathlib import Path
|
||||
from pprint import pformat
|
||||
|
||||
from metagpt.const import METAGPT_ROOT
|
||||
from metagpt.logs import logger
|
||||
from metagpt.repo_parser import RepoParser
|
||||
|
||||
|
||||
def test_repo_parser():
|
||||
repo_parser = RepoParser(base_directory=METAGPT_ROOT / "metagpt" / "strategy")
|
||||
symbols = repo_parser.generate_symbols()
|
||||
logger.info(pformat(symbols))
|
||||
|
||||
assert "tot_schema.py" in str(symbols)
|
||||
|
||||
output_path = repo_parser.generate_structure(mode="json")
|
||||
assert output_path.exists()
|
||||
output_path = repo_parser.generate_structure(mode="csv")
|
||||
assert output_path.exists()
|
||||
|
||||
|
||||
def test_error():
|
||||
"""_parse_file should return empty list when file not existed"""
|
||||
rsp = RepoParser._parse_file(Path("test_not_existed_file.py"))
|
||||
assert rsp == []
|
||||
Loading…
Add table
Add a link
Reference in a new issue