MCPcopy Index your code
hub / github.com/Persper/code-analytics / test_map_id

Function test_map_id

test/test_graphs/test_map_id.py:9–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8
9def test_map_id():
10 repo_path = os.path.join(root_path, 'repos/js_test_repo')
11 script_path = os.path.join(root_path, 'tools/repo_creater/create_repo.py')
12 test_src_path = os.path.join(root_path, 'test/js_test_repo')
13 if not os.path.isdir(repo_path):
14 cmd = '{} {}'.format(script_path, test_src_path)
15 subprocess.call(cmd, shell=True)
16
17 server_addr = 'http://localhost:3000'
18 az = Analyzer(repo_path, GraphServerHttp(server_addr, JS_FILENAME_REGEXES))
19
20 az.ordered_shas = ['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7']
21
22 az.id_map = {
23 'c1': {'A': 'B'},
24 'c2': {'B': 'C', 'E': 'F'},
25 'c3': {'C': 'D', 'F': 'G'},
26 'c4': {'G': 'H'},
27 'c5': {'D': 'I', 'J': 'K'},
28 'c6': {'I': 'B', 'H': 'E'}, # make two cycles
29 'c7': {'B': 'L'} # remove a cycle
30 }
31
32 final_map_truth = {
33 'A': 'L',
34 'B': 'L',
35 'C': 'L',
36 'D': 'L',
37 'I': 'L',
38 'E': 'E',
39 'F': 'E',
40 'G': 'E',
41 'H': 'E',
42 'J': 'K'
43 }
44
45 final_map = az.aggregate_id_map()
46 assert(final_map_truth == final_map)

Callers

nothing calls this directly

Calls 3

aggregate_id_mapMethod · 0.95
AnalyzerClass · 0.90
GraphServerHttpClass · 0.90

Tested by

no test coverage detected