def test_tree_graph_growth(self): """ Test function that allows testing of the number of nodes in a marker tree graph """ from furious.marker_tree.graph_analysis import tree_graph_growth sizes = [tree_graph_growth(n) for n in range(0, 100, 10)] expected = [1, 11, 23, 35, 47, 59, 71, 83, 95, 107] self.assertEqual(sizes, expected)
def test_build_tree_from_context(self): from furious.context import _local from furious.context.context import Context from furious.marker_tree.marker import Marker from furious.marker_tree.graph_analysis import tree_graph_growth from furious.tests.marker_tree import dummy_success_callback context = Context() for arg in xrange(23): context.add(target=dummy_success_callback, args=[arg]) _local.get_local_context().registry.append(context) root_marker = Marker.make_marker_tree_for_context(context) root_marker.persist() # Plus one, because of the empty context. self.assertEqual(root_marker.count_nodes(), tree_graph_growth(23))