MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / test_all

Function test_all

tests/test_graphs.py:60–80  ·  view source on GitHub ↗
(test_tup)

Source from the content-addressed store, hash-verified

58
59@pytest.mark.parametrize("test_tup", flattened_tests)
60def test_all(test_tup):
61 os.chdir(os.path.dirname(os.path.abspath(__file__)))
62 (language, test_dict) = flattened_tests[test_tup]
63 print("Running test %r..." % test_dict['test_name'])
64 directory_path = os.path.join('test_code', language, test_dict['directory'])
65 kwargs = test_dict.get('kwargs', {})
66 kwargs['lang_params'] = LanguageParams(kwargs.pop('source_type', 'script'),
67 kwargs.pop('ruby_version', '27'))
68 kwargs['subset_params'] = SubsetParams.generate(kwargs.pop('target_function', ''),
69 int(kwargs.pop('upstream_depth', 0)),
70 int(kwargs.pop('downstream_depth', 0)))
71 output_file = io.StringIO()
72 code2flow([directory_path], output_file, language, **kwargs)
73
74 generated_edges = get_edges_set_from_file(output_file)
75 print("generated_edges eq", file=sys.stderr)
76 assert_eq(generated_edges, set(map(tuple, test_dict['expected_edges'])))
77
78 generated_nodes = get_nodes_set_from_file(output_file)
79 print("generated_nodes eq", file=sys.stderr)
80 assert_eq(generated_nodes, set(test_dict['expected_nodes']))
81
82
83def get_nodes_set_from_file(dot_file):

Callers

nothing calls this directly

Calls 8

LanguageParamsClass · 0.90
code2flowFunction · 0.90
get_edges_set_from_fileFunction · 0.85
assert_eqFunction · 0.85
setFunction · 0.85
mapFunction · 0.85
get_nodes_set_from_fileFunction · 0.85
generateMethod · 0.80

Tested by

no test coverage detected