MCPcopy Index your code
hub / github.com/clips/pattern / test_cache

Method test_cache

test/test_graph.py:198–213  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

196 print "pattern.graph.Graph.add_edge()"
197
198 def test_cache(self):
199 # Assert adjacency cache is flushed when nodes, edges or direction changes.
200 g = self.g.copy()
201 g.eigenvector_centrality()
202 self.assertEqual(g._adjacency[0]["a"], {})
203 self.assertEqual(g._adjacency[0]["b"]["a"], 1.0)
204 g.add_node("d")
205 g.add_node("e")
206 self.assertEqual(g._adjacency, None)
207 g.betweenness_centrality()
208 self.assertEqual(g._adjacency[0]["a"]["b"], 1.0)
209 self.assertEqual(g._adjacency[0]["b"]["a"], 1.0)
210 g.add_edge("d", "e", weight=0.0)
211 g.remove(g.node("d"))
212 g.remove(g.node("e"))
213 print "pattern.graph.Graph._adjacency"
214
215 def test_paths(self):
216 # Assert node paths.

Callers

nothing calls this directly

Calls 7

nodeMethod · 0.80
copyMethod · 0.45
add_nodeMethod · 0.45
add_edgeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected