Exemplo n.º 1
0
 def test_slushy_syntax_errors(self):
     syntax_errors = get_syntax_errors(self.slushy_graph)
     for _, exc, _ in syntax_errors:
         self.assertIsInstance(exc, BELSyntaxError)
     self.assertEqual(1, len(syntax_errors))
     _, first_exc, _ = syntax_errors[0]
     self.assertEqual(98, first_exc.line_number)
Exemplo n.º 2
0
 def from_graph(graph: BELGraph) -> BELGraphSummary:
     """Create a summary of the graph."""
     return BELGraphSummary(
         # Attribute counters
         function_count=graph.count.functions(),
         modifications_count=graph.count.modifications(),
         relation_count=graph.count.relations(),
         authors_count=graph.count.authors(),
         variants_count=graph.count.variants(),
         namespaces_count=graph.count.namespaces(),
         # Errors
         undefined_namespaces=get_undefined_namespaces(graph),
         undefined_annotations=get_undefined_annotations(graph),
         namespaces_with_incorrect_names=get_namespaces_with_incorrect_names(
             graph),
         unused_namespaces=get_unused_namespaces(graph),
         unused_annotations=get_unused_annotations(graph),
         unused_list_annotation_values=get_unused_list_annotation_values(
             graph),
         naked_names=get_naked_names(graph),
         error_count=graph.count.error_types(),
         error_groups=get_most_common_errors(graph),
         syntax_errors=get_syntax_errors(graph),
         # Node pairs
         regulatory_pairs=get_regulatory_pairs(graph),
         chaotic_pairs=get_chaotic_pairs(graph),
         dampened_pairs=get_dampened_pairs(graph),
         contradictory_pairs=get_contradiction_summary(graph),
         separate_unstable_correlation_triples=
         get_separate_unstable_correlation_triples(graph),
         mutually_unstable_correlation_triples=
         get_mutually_unstable_correlation_triples(graph),
         jens_unstable=get_jens_unstable(graph),
         increase_mismatch_triplets=get_increase_mismatch_triplets(graph),
         decrease_mismatch_triplets=get_decrease_mismatch_triplets(graph),
         # Bibliometrics
         citation_years=get_citation_years(graph),
         confidence_count=count_confidences(graph),
         # Random
         hub_data=_count_top_hubs(graph),
         disease_data=_count_top_diseases(graph),
     )
Exemplo n.º 3
0
 def test_slushy_syntax_errors(self):
     syntax_errors = get_syntax_errors(self.slushy_graph)
     self.assertEqual(1, len(syntax_errors))
     self.assertEqual(98, syntax_errors[0][0])