Example #1
0
 def test_clear_removes_all_nodes_and_edges_and_color_boundaries(self):
     call_graph = CallGraph()
     call_graph.load_nodes({
         'dummy_hash1': {
             'name': 'dummy_name1',
             'source': 'dummy_source1',
             'call_count': 3
         },
         'dummy_hash2': {
             'name': 'dummy_name2',
             'source': 'dummy_source2',
             'call_count': 1
         }
     })
     call_graph.load_edges({
         ('node_hash1', 'node_hash2'): {
             'param': [],
             'call_count': 0
         },
         ('node_hash3', 'node_hash4'): {
             'param': ['dummy_param'],
             'call_count': 3
         }
     })
     call_graph.clear()
     self.assertEqual(call_graph.get_nodes(), {})
     self.assertEqual(call_graph.get_edges(), {})
     self.assertEqual(call_graph.get_yellow(), 0)
     self.assertEqual(call_graph.get_red(), 0)
Example #2
0
 def test_get_edges_returns_loaded_edges(self):
     call_graph = CallGraph()
     call_graph.load_edges({
         ('node_hash1', 'node_hash2'): {
             'param': [],
             'call_count': 0
         },
         ('node_hash3', 'node_hash4'): {
             'param': ['dummy_param'],
             'call_count': 3
         }
     })
     expected_edges = {
         ('node_hash1', 'node_hash2'): {
             'params': [],
             'call_count': 0
         },
         ('node_hash3', 'node_hash4'): {
             'params': [['dummy_param']],
             'call_count': 3
         }
     }
     self.assertEqual(call_graph.get_edges(), expected_edges)