Ejemplo n.º 1
0
 def test_check_for_cycle1(self):
     # cyclic case
     graph = build_graph(nodes_attributes, [('node_1', 'node_1_data'),
                                            ('node_1_data', 'node_3'),
                                            ('node_3', 'node_3_data'),
                                            ('node_3_data', 'node_1')],
                         nodes_with_edges_only=True)
     with self.assertRaisesRegex(
             Error, 'Graph contains a cycle. Can not proceed.*'):
         CheckForCycle().find_and_replace_pattern(graph)
Ejemplo n.º 2
0
 def test_check_for_cycle2(self):
     # acyclic case
     graph = build_graph(nodes_attributes, [('node_1', 'node_1_data'),
                                            ('node_1_data', 'node_3'),
                                            ('node_3', 'node_3_data'),
                                            ('node_3_data', 'mul_1'),
                                            ('mul_1_w', 'mul_1'),
                                            ('mul_1', 'mul_1_data')],
                         nodes_with_edges_only=True)
     try:
         CheckForCycle().find_and_replace_pattern(graph)
     except Error:
         self.fail("Unexpected Error raised")