Ejemplo n.º 1
0
 def test_fix_up_edges_excluded_edges(self):
     self.assertEqual(syntax_only_excluded_edge_types, all_edge_types.difference(syntax_only_edge_types))
     for graph, instances in tqdm(self.task.graphs_and_instances):
         graph, _ = Model.fix_up_edges(graph, instances, excluded_edge_types=syntax_only_excluded_edge_types)
         for e in graph.edges:
             if e[3]['type'].startswith('reverse_'):
                 e[3]['type'] = e[3]['type'][8:]
             self.assertIn(e[3]['type'], syntax_only_edge_types)
 def test_excluded_edge_types(self):
     self.assertEqual(all_edge_types, frozenset(['AST',
                                                 'NEXT_TOKEN',
                                                 'LAST_READ',
                                                 'LAST_WRITE',
                                                 'COMPUTED_FROM',
                                                 'RETURNS_TO',
                                                 'LAST_LEXICAL_SCOPE_USE',
                                                 'LAST_FIELD_LEX',
                                                 'FIELD']))
     self.assertEqual(syntax_only_edge_types, frozenset(['AST', 'NEXT_TOKEN', ]))
     self.assertEqual(syntax_only_excluded_edge_types, all_edge_types.difference(syntax_only_edge_types))