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

Function test_json

tests/test_interface.py:87–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86
87def test_json():
88 code2flow('test_code/py/simple_b',
89 output_file='/tmp/code2flow/out.json',
90 hide_legend=False)
91 with open('/tmp/code2flow/out.json') as f:
92 jobj = json.loads(f.read())
93 assert set(jobj.keys()) == {'graph'}
94 assert set(jobj['graph'].keys()) == {'nodes', 'edges', 'directed'}
95 assert jobj['graph']['directed'] is True
96 assert isinstance(jobj['graph']['nodes'], dict)
97 assert len(jobj['graph']['nodes']) == 4
98 assert set(n['name'] for n in jobj['graph']['nodes'].values()) == {'simple_b::a', 'simple_b::(global)', 'simple_b::c.d', 'simple_b::b'}
99
100 assert isinstance(jobj['graph']['edges'], list)
101 assert len(jobj['graph']['edges']) == 4
102 assert len(set(n['source'] for n in jobj['graph']['edges'])) == 4
103 assert len(set(n['target'] for n in jobj['graph']['edges'])) == 3
104
105
106def test_weird_encoding():

Callers

nothing calls this directly

Calls 3

code2flowFunction · 0.90
setFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected