1 Star 0 Fork 4

will0253/code2flow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
make_expected.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
Scott Rogowski 提交于 2021-12-26 20:05 . Subsets (#44)
#!/usr/bin/env python3
import os
import pprint
import sys
import tempfile
from code2flow.engine import main
from tests.test_graphs import get_edges_set_from_file, get_nodes_set_from_file
DESCRIPTION = """
This file is a tool to generate test cases given a directory
"""
if __name__ == '__main__':
output_filename = tempfile.NamedTemporaryFile(suffix='.gv').name
args = sys.argv[1:] + ['--output', output_filename]
main(args)
output_file = open(output_filename, 'r')
generated_edges = get_edges_set_from_file(output_file)
generated_nodes = get_nodes_set_from_file(output_file)
directory = os.path.split(sys.argv[1])[-1]
ret = {
'test_name': directory,
'directory': directory,
'kwargs': sys.argv[2:],
'expected_edges': list(map(list, generated_edges)),
'expected_nodes': list(generated_nodes),
}
ret = pprint.pformat(ret, sort_dicts=False)
ret = " " + ret.replace("'", '"')[1:-1]
print('\n'.join(" " + l for l in ret.split('\n')))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/will0253/code2flow.git
git@gitee.com:will0253/code2flow.git
will0253
code2flow
code2flow
master

搜索帮助