def build_file_graph(file_dict, dir_path): """ Build a hierarchical graph with a given file paths and store the root path in 'data/Constants.json' file. :param file_dict: File dictionary returned by coala. :param dir_path: Directory that stores the generated webpage code. """ tr = Tree(parse_file_dict(file_dict).keys()) home_file = get_file(Constants.CONFIGS['home'], dir_path) with open(home_file, 'w') as hm: hm.write(tr.root.name) return tr.extract()
def test_graph(self): tr = Tree(self.FL) testChild = tr.root.child['tests'].child.get('specs', None) self.assertTrue(testChild)
def test_extract(self): tr = Tree(self.FL) result = tr.extract() self.assertIn(tr.root.abspath, result.keys())
def test_graph(self): tr = Tree(self.FL) testChild = tr.root.child.keys() self.assertCountEqual(testChild, os.listdir('tests'))